
obj/kern/kernel:     file format elf32-i386


Disassembly of section .text:

f0100000 <_start+0xeffffff4>:
.globl		_start
_start = RELOC(entry)

.globl entry
entry:
	movw	$0x1234,0x472			# warm boot
f0100000:	02 b0 ad 1b 00 00    	add    0x1bad(%eax),%dh
f0100006:	00 00                	add    %al,(%eax)
f0100008:	fe 4f 52             	decb   0x52(%edi)
f010000b:	e4                   	.byte 0xe4

f010000c <entry>:
f010000c:	66 c7 05 72 04 00 00 	movw   $0x1234,0x472
f0100013:	34 12 
	# sufficient until we set up our real page table in mem_init
	# in lab 2.

	# Load the physical address of entry_pgdir into cr3.  entry_pgdir
	# is defined in entrypgdir.c.
	movl	$(RELOC(entry_pgdir)), %eax
f0100015:	b8 00 10 12 00       	mov    $0x121000,%eax
	movl	%eax, %cr3
f010001a:	0f 22 d8             	mov    %eax,%cr3
	# Turn on paging.
	movl	%cr0, %eax
f010001d:	0f 20 c0             	mov    %cr0,%eax
	orl	$(CR0_PE|CR0_PG|CR0_WP), %eax
f0100020:	0d 01 00 01 80       	or     $0x80010001,%eax
	movl	%eax, %cr0
f0100025:	0f 22 c0             	mov    %eax,%cr0

	# Now paging is enabled, but we're still running at a low EIP
	# (why is this okay?).  Jump up above KERNBASE before entering
	# C code.
	mov	$relocated, %eax
f0100028:	b8 2f 00 10 f0       	mov    $0xf010002f,%eax
	jmp	*%eax
f010002d:	ff e0                	jmp    *%eax

f010002f <relocated>:
relocated:

	# Clear the frame pointer register (EBP)
	# so that once we get into debugging C code,
	# stack backtraces will be terminated properly.
	movl	$0x0,%ebp			# nuke frame pointer
f010002f:	bd 00 00 00 00       	mov    $0x0,%ebp

	# Set the stack pointer
	movl	$(bootstacktop),%esp
f0100034:	bc 00 10 12 f0       	mov    $0xf0121000,%esp

	# now to C code
	call	i386_init
f0100039:	e8 62 00 00 00       	call   f01000a0 <i386_init>

f010003e <spin>:

	# Should never get here, but in case we do, just spin.
spin:	jmp	spin
f010003e:	eb fe                	jmp    f010003e <spin>

f0100040 <_panic>:
 * Panic is called on unresolvable fatal errors.
 * It prints "panic: mesg", and then enters the kernel monitor.
 */
void
_panic(const char *file, int line, const char *fmt,...)
{
f0100040:	f3 0f 1e fb          	endbr32 
f0100044:	55                   	push   %ebp
f0100045:	89 e5                	mov    %esp,%ebp
f0100047:	56                   	push   %esi
f0100048:	53                   	push   %ebx
f0100049:	8b 75 10             	mov    0x10(%ebp),%esi
	va_list ap;

	if (panicstr)
f010004c:	83 3d 80 7e 21 f0 00 	cmpl   $0x0,0xf0217e80
f0100053:	74 0f                	je     f0100064 <_panic+0x24>
	va_end(ap);

dead:
	/* break into the kernel monitor */
	while (1)
		monitor(NULL);
f0100055:	83 ec 0c             	sub    $0xc,%esp
f0100058:	6a 00                	push   $0x0
f010005a:	e8 67 08 00 00       	call   f01008c6 <monitor>
f010005f:	83 c4 10             	add    $0x10,%esp
f0100062:	eb f1                	jmp    f0100055 <_panic+0x15>
	panicstr = fmt;
f0100064:	89 35 80 7e 21 f0    	mov    %esi,0xf0217e80
	asm volatile("cli; cld");
f010006a:	fa                   	cli    
f010006b:	fc                   	cld    
	va_start(ap, fmt);
f010006c:	8d 5d 14             	lea    0x14(%ebp),%ebx
	cprintf("kernel panic on CPU %d at %s:%d: ", cpunum(), file, line);
f010006f:	e8 96 5e 00 00       	call   f0105f0a <cpunum>
f0100074:	ff 75 0c             	pushl  0xc(%ebp)
f0100077:	ff 75 08             	pushl  0x8(%ebp)
f010007a:	50                   	push   %eax
f010007b:	68 80 65 10 f0       	push   $0xf0106580
f0100080:	e8 58 37 00 00       	call   f01037dd <cprintf>
	vcprintf(fmt, ap);
f0100085:	83 c4 08             	add    $0x8,%esp
f0100088:	53                   	push   %ebx
f0100089:	56                   	push   %esi
f010008a:	e8 24 37 00 00       	call   f01037b3 <vcprintf>
	cprintf("\n");
f010008f:	c7 04 24 05 77 10 f0 	movl   $0xf0107705,(%esp)
f0100096:	e8 42 37 00 00       	call   f01037dd <cprintf>
f010009b:	83 c4 10             	add    $0x10,%esp
f010009e:	eb b5                	jmp    f0100055 <_panic+0x15>

f01000a0 <i386_init>:
{
f01000a0:	f3 0f 1e fb          	endbr32 
f01000a4:	55                   	push   %ebp
f01000a5:	89 e5                	mov    %esp,%ebp
f01000a7:	53                   	push   %ebx
f01000a8:	83 ec 04             	sub    $0x4,%esp
	cons_init();
f01000ab:	e8 a9 05 00 00       	call   f0100659 <cons_init>
	cprintf("6828 decimal is %o octal!\n", 6828);
f01000b0:	83 ec 08             	sub    $0x8,%esp
f01000b3:	68 ac 1a 00 00       	push   $0x1aac
f01000b8:	68 ec 65 10 f0       	push   $0xf01065ec
f01000bd:	e8 1b 37 00 00       	call   f01037dd <cprintf>
	mem_init();
f01000c2:	e8 83 11 00 00       	call   f010124a <mem_init>
	env_init();
f01000c7:	e8 85 2f 00 00       	call   f0103051 <env_init>
	trap_init();
f01000cc:	e8 2f 38 00 00       	call   f0103900 <trap_init>
	mp_init();
f01000d1:	e8 35 5b 00 00       	call   f0105c0b <mp_init>
	lapic_init();
f01000d6:	e8 49 5e 00 00       	call   f0105f24 <lapic_init>
	pic_init();
f01000db:	e8 12 36 00 00       	call   f01036f2 <pic_init>
extern struct spinlock kernel_lock;

static inline void
lock_kernel(void)
{
	spin_lock(&kernel_lock);
f01000e0:	c7 04 24 c0 33 12 f0 	movl   $0xf01233c0,(%esp)
f01000e7:	e8 a6 60 00 00       	call   f0106192 <spin_lock>
#define KADDR(pa) _kaddr(__FILE__, __LINE__, pa)

static inline void*
_kaddr(const char *file, int line, physaddr_t pa)
{
	if (PGNUM(pa) >= npages)
f01000ec:	83 c4 10             	add    $0x10,%esp
f01000ef:	83 3d 88 7e 21 f0 07 	cmpl   $0x7,0xf0217e88
f01000f6:	76 27                	jbe    f010011f <i386_init+0x7f>
	memmove(code, mpentry_start, mpentry_end - mpentry_start);
f01000f8:	83 ec 04             	sub    $0x4,%esp
f01000fb:	b8 6e 5b 10 f0       	mov    $0xf0105b6e,%eax
f0100100:	2d f4 5a 10 f0       	sub    $0xf0105af4,%eax
f0100105:	50                   	push   %eax
f0100106:	68 f4 5a 10 f0       	push   $0xf0105af4
f010010b:	68 00 70 00 f0       	push   $0xf0007000
f0100110:	e8 21 58 00 00       	call   f0105936 <memmove>
	for (c = cpus; c < cpus + ncpu; c++) {
f0100115:	83 c4 10             	add    $0x10,%esp
f0100118:	bb 20 80 21 f0       	mov    $0xf0218020,%ebx
f010011d:	eb 53                	jmp    f0100172 <i386_init+0xd2>
		_panic(file, line, "KADDR called with invalid pa %08lx", pa);
f010011f:	68 00 70 00 00       	push   $0x7000
f0100124:	68 a4 65 10 f0       	push   $0xf01065a4
f0100129:	6a 58                	push   $0x58
f010012b:	68 07 66 10 f0       	push   $0xf0106607
f0100130:	e8 0b ff ff ff       	call   f0100040 <_panic>
		mpentry_kstack = percpu_kstacks[c - cpus] + KSTKSIZE;
f0100135:	89 d8                	mov    %ebx,%eax
f0100137:	2d 20 80 21 f0       	sub    $0xf0218020,%eax
f010013c:	c1 f8 02             	sar    $0x2,%eax
f010013f:	69 c0 35 c2 72 4f    	imul   $0x4f72c235,%eax,%eax
f0100145:	c1 e0 0f             	shl    $0xf,%eax
f0100148:	8d 80 00 10 22 f0    	lea    -0xfddf000(%eax),%eax
f010014e:	a3 84 7e 21 f0       	mov    %eax,0xf0217e84
		lapic_startap(c->cpu_id, PADDR(code));
f0100153:	83 ec 08             	sub    $0x8,%esp
f0100156:	68 00 70 00 00       	push   $0x7000
f010015b:	0f b6 03             	movzbl (%ebx),%eax
f010015e:	50                   	push   %eax
f010015f:	e8 1a 5f 00 00       	call   f010607e <lapic_startap>
		while(c->cpu_status != CPU_STARTED)
f0100164:	83 c4 10             	add    $0x10,%esp
f0100167:	8b 43 04             	mov    0x4(%ebx),%eax
f010016a:	83 f8 01             	cmp    $0x1,%eax
f010016d:	75 f8                	jne    f0100167 <i386_init+0xc7>
	for (c = cpus; c < cpus + ncpu; c++) {
f010016f:	83 c3 74             	add    $0x74,%ebx
f0100172:	6b 05 c4 83 21 f0 74 	imul   $0x74,0xf02183c4,%eax
f0100179:	05 20 80 21 f0       	add    $0xf0218020,%eax
f010017e:	39 c3                	cmp    %eax,%ebx
f0100180:	73 13                	jae    f0100195 <i386_init+0xf5>
		if (c == cpus + cpunum())  // We've started already.
f0100182:	e8 83 5d 00 00       	call   f0105f0a <cpunum>
f0100187:	6b c0 74             	imul   $0x74,%eax,%eax
f010018a:	05 20 80 21 f0       	add    $0xf0218020,%eax
f010018f:	39 c3                	cmp    %eax,%ebx
f0100191:	74 dc                	je     f010016f <i386_init+0xcf>
f0100193:	eb a0                	jmp    f0100135 <i386_init+0x95>
	ENV_CREATE(fs_fs, ENV_TYPE_FS);
f0100195:	83 ec 08             	sub    $0x8,%esp
f0100198:	6a 01                	push   $0x1
f010019a:	68 a8 38 1d f0       	push   $0xf01d38a8
f010019f:	e8 4f 30 00 00       	call   f01031f3 <env_create>
	ENV_CREATE(TEST, ENV_TYPE_USER);
f01001a4:	83 c4 08             	add    $0x8,%esp
f01001a7:	6a 00                	push   $0x0
f01001a9:	68 50 68 20 f0       	push   $0xf0206850
f01001ae:	e8 40 30 00 00       	call   f01031f3 <env_create>
	kbd_intr();
f01001b3:	e8 45 04 00 00       	call   f01005fd <kbd_intr>
	sched_yield();
f01001b8:	e8 33 45 00 00       	call   f01046f0 <sched_yield>

f01001bd <mp_main>:
{
f01001bd:	f3 0f 1e fb          	endbr32 
f01001c1:	55                   	push   %ebp
f01001c2:	89 e5                	mov    %esp,%ebp
f01001c4:	83 ec 08             	sub    $0x8,%esp
	lcr3(PADDR(kern_pgdir));
f01001c7:	a1 8c 7e 21 f0       	mov    0xf0217e8c,%eax
	if ((uint32_t)kva < KERNBASE)
f01001cc:	3d ff ff ff ef       	cmp    $0xefffffff,%eax
f01001d1:	76 52                	jbe    f0100225 <mp_main+0x68>
	return (physaddr_t)kva - KERNBASE;
f01001d3:	05 00 00 00 10       	add    $0x10000000,%eax
}

static inline void
lcr3(uint32_t val)
{
	asm volatile("movl %0,%%cr3" : : "r" (val));
f01001d8:	0f 22 d8             	mov    %eax,%cr3
	cprintf("SMP: CPU %d starting\n", cpunum());
f01001db:	e8 2a 5d 00 00       	call   f0105f0a <cpunum>
f01001e0:	83 ec 08             	sub    $0x8,%esp
f01001e3:	50                   	push   %eax
f01001e4:	68 13 66 10 f0       	push   $0xf0106613
f01001e9:	e8 ef 35 00 00       	call   f01037dd <cprintf>
	lapic_init();
f01001ee:	e8 31 5d 00 00       	call   f0105f24 <lapic_init>
	env_init_percpu();
f01001f3:	e8 29 2e 00 00       	call   f0103021 <env_init_percpu>
	trap_init_percpu();
f01001f8:	e8 f8 35 00 00       	call   f01037f5 <trap_init_percpu>
	xchg(&thiscpu->cpu_status, CPU_STARTED); // tell boot_aps() we're up
f01001fd:	e8 08 5d 00 00       	call   f0105f0a <cpunum>
f0100202:	6b d0 74             	imul   $0x74,%eax,%edx
f0100205:	83 c2 04             	add    $0x4,%edx
xchg(volatile uint32_t *addr, uint32_t newval)
{
	uint32_t result;

	// The + in "+m" denotes a read-modify-write operand.
	asm volatile("lock; xchgl %0, %1"
f0100208:	b8 01 00 00 00       	mov    $0x1,%eax
f010020d:	f0 87 82 20 80 21 f0 	lock xchg %eax,-0xfde7fe0(%edx)
f0100214:	c7 04 24 c0 33 12 f0 	movl   $0xf01233c0,(%esp)
f010021b:	e8 72 5f 00 00       	call   f0106192 <spin_lock>
	sched_yield();
f0100220:	e8 cb 44 00 00       	call   f01046f0 <sched_yield>
		_panic(file, line, "PADDR called with invalid kva %08lx", kva);
f0100225:	50                   	push   %eax
f0100226:	68 c8 65 10 f0       	push   $0xf01065c8
f010022b:	6a 6f                	push   $0x6f
f010022d:	68 07 66 10 f0       	push   $0xf0106607
f0100232:	e8 09 fe ff ff       	call   f0100040 <_panic>

f0100237 <_warn>:
}

/* like panic, but don't */
void
_warn(const char *file, int line, const char *fmt,...)
{
f0100237:	f3 0f 1e fb          	endbr32 
f010023b:	55                   	push   %ebp
f010023c:	89 e5                	mov    %esp,%ebp
f010023e:	53                   	push   %ebx
f010023f:	83 ec 08             	sub    $0x8,%esp
	va_list ap;

	va_start(ap, fmt);
f0100242:	8d 5d 14             	lea    0x14(%ebp),%ebx
	cprintf("kernel warning at %s:%d: ", file, line);
f0100245:	ff 75 0c             	pushl  0xc(%ebp)
f0100248:	ff 75 08             	pushl  0x8(%ebp)
f010024b:	68 29 66 10 f0       	push   $0xf0106629
f0100250:	e8 88 35 00 00       	call   f01037dd <cprintf>
	vcprintf(fmt, ap);
f0100255:	83 c4 08             	add    $0x8,%esp
f0100258:	53                   	push   %ebx
f0100259:	ff 75 10             	pushl  0x10(%ebp)
f010025c:	e8 52 35 00 00       	call   f01037b3 <vcprintf>
	cprintf("\n");
f0100261:	c7 04 24 05 77 10 f0 	movl   $0xf0107705,(%esp)
f0100268:	e8 70 35 00 00       	call   f01037dd <cprintf>
	va_end(ap);
}
f010026d:	83 c4 10             	add    $0x10,%esp
f0100270:	8b 5d fc             	mov    -0x4(%ebp),%ebx
f0100273:	c9                   	leave  
f0100274:	c3                   	ret    

f0100275 <serial_proc_data>:

static bool serial_exists;

static int
serial_proc_data(void)
{
f0100275:	f3 0f 1e fb          	endbr32 
	asm volatile("inb %w1,%0" : "=a" (data) : "d" (port));
f0100279:	ba fd 03 00 00       	mov    $0x3fd,%edx
f010027e:	ec                   	in     (%dx),%al
	if (!(inb(COM1+COM_LSR) & COM_LSR_DATA))
f010027f:	a8 01                	test   $0x1,%al
f0100281:	74 0a                	je     f010028d <serial_proc_data+0x18>
f0100283:	ba f8 03 00 00       	mov    $0x3f8,%edx
f0100288:	ec                   	in     (%dx),%al
		return -1;
	return inb(COM1+COM_RX);
f0100289:	0f b6 c0             	movzbl %al,%eax
f010028c:	c3                   	ret    
		return -1;
f010028d:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
f0100292:	c3                   	ret    

f0100293 <cons_intr>:

// called by device interrupt routines to feed input characters
// into the circular console input buffer.
static void
cons_intr(int (*proc)(void))
{
f0100293:	55                   	push   %ebp
f0100294:	89 e5                	mov    %esp,%ebp
f0100296:	53                   	push   %ebx
f0100297:	83 ec 04             	sub    $0x4,%esp
f010029a:	89 c3                	mov    %eax,%ebx
	int c;

	while ((c = (*proc)()) != -1) {
f010029c:	ff d3                	call   *%ebx
f010029e:	83 f8 ff             	cmp    $0xffffffff,%eax
f01002a1:	74 29                	je     f01002cc <cons_intr+0x39>
		if (c == 0)
f01002a3:	85 c0                	test   %eax,%eax
f01002a5:	74 f5                	je     f010029c <cons_intr+0x9>
			continue;
		cons.buf[cons.wpos++] = c;
f01002a7:	8b 0d 24 72 21 f0    	mov    0xf0217224,%ecx
f01002ad:	8d 51 01             	lea    0x1(%ecx),%edx
f01002b0:	88 81 20 70 21 f0    	mov    %al,-0xfde8fe0(%ecx)
		if (cons.wpos == CONSBUFSIZE)
f01002b6:	81 fa 00 02 00 00    	cmp    $0x200,%edx
			cons.wpos = 0;
f01002bc:	b8 00 00 00 00       	mov    $0x0,%eax
f01002c1:	0f 44 d0             	cmove  %eax,%edx
f01002c4:	89 15 24 72 21 f0    	mov    %edx,0xf0217224
f01002ca:	eb d0                	jmp    f010029c <cons_intr+0x9>
	}
}
f01002cc:	83 c4 04             	add    $0x4,%esp
f01002cf:	5b                   	pop    %ebx
f01002d0:	5d                   	pop    %ebp
f01002d1:	c3                   	ret    

f01002d2 <kbd_proc_data>:
{
f01002d2:	f3 0f 1e fb          	endbr32 
f01002d6:	55                   	push   %ebp
f01002d7:	89 e5                	mov    %esp,%ebp
f01002d9:	53                   	push   %ebx
f01002da:	83 ec 04             	sub    $0x4,%esp
f01002dd:	ba 64 00 00 00       	mov    $0x64,%edx
f01002e2:	ec                   	in     (%dx),%al
	if ((stat & KBS_DIB) == 0)
f01002e3:	a8 01                	test   $0x1,%al
f01002e5:	0f 84 f2 00 00 00    	je     f01003dd <kbd_proc_data+0x10b>
	if (stat & KBS_TERR)
f01002eb:	a8 20                	test   $0x20,%al
f01002ed:	0f 85 f1 00 00 00    	jne    f01003e4 <kbd_proc_data+0x112>
f01002f3:	ba 60 00 00 00       	mov    $0x60,%edx
f01002f8:	ec                   	in     (%dx),%al
f01002f9:	89 c2                	mov    %eax,%edx
	if (data == 0xE0) {
f01002fb:	3c e0                	cmp    $0xe0,%al
f01002fd:	74 61                	je     f0100360 <kbd_proc_data+0x8e>
	} else if (data & 0x80) {
f01002ff:	84 c0                	test   %al,%al
f0100301:	78 70                	js     f0100373 <kbd_proc_data+0xa1>
	} else if (shift & E0ESC) {
f0100303:	8b 0d 00 70 21 f0    	mov    0xf0217000,%ecx
f0100309:	f6 c1 40             	test   $0x40,%cl
f010030c:	74 0e                	je     f010031c <kbd_proc_data+0x4a>
		data |= 0x80;
f010030e:	83 c8 80             	or     $0xffffff80,%eax
f0100311:	89 c2                	mov    %eax,%edx
		shift &= ~E0ESC;
f0100313:	83 e1 bf             	and    $0xffffffbf,%ecx
f0100316:	89 0d 00 70 21 f0    	mov    %ecx,0xf0217000
	shift |= shiftcode[data];
f010031c:	0f b6 d2             	movzbl %dl,%edx
f010031f:	0f b6 82 a0 67 10 f0 	movzbl -0xfef9860(%edx),%eax
f0100326:	0b 05 00 70 21 f0    	or     0xf0217000,%eax
	shift ^= togglecode[data];
f010032c:	0f b6 8a a0 66 10 f0 	movzbl -0xfef9960(%edx),%ecx
f0100333:	31 c8                	xor    %ecx,%eax
f0100335:	a3 00 70 21 f0       	mov    %eax,0xf0217000
	c = charcode[shift & (CTL | SHIFT)][data];
f010033a:	89 c1                	mov    %eax,%ecx
f010033c:	83 e1 03             	and    $0x3,%ecx
f010033f:	8b 0c 8d 80 66 10 f0 	mov    -0xfef9980(,%ecx,4),%ecx
f0100346:	0f b6 14 11          	movzbl (%ecx,%edx,1),%edx
f010034a:	0f b6 da             	movzbl %dl,%ebx
	if (shift & CAPSLOCK) {
f010034d:	a8 08                	test   $0x8,%al
f010034f:	74 61                	je     f01003b2 <kbd_proc_data+0xe0>
		if ('a' <= c && c <= 'z')
f0100351:	89 da                	mov    %ebx,%edx
f0100353:	8d 4b 9f             	lea    -0x61(%ebx),%ecx
f0100356:	83 f9 19             	cmp    $0x19,%ecx
f0100359:	77 4b                	ja     f01003a6 <kbd_proc_data+0xd4>
			c += 'A' - 'a';
f010035b:	83 eb 20             	sub    $0x20,%ebx
f010035e:	eb 0c                	jmp    f010036c <kbd_proc_data+0x9a>
		shift |= E0ESC;
f0100360:	83 0d 00 70 21 f0 40 	orl    $0x40,0xf0217000
		return 0;
f0100367:	bb 00 00 00 00       	mov    $0x0,%ebx
}
f010036c:	89 d8                	mov    %ebx,%eax
f010036e:	8b 5d fc             	mov    -0x4(%ebp),%ebx
f0100371:	c9                   	leave  
f0100372:	c3                   	ret    
		data = (shift & E0ESC ? data : data & 0x7F);
f0100373:	8b 0d 00 70 21 f0    	mov    0xf0217000,%ecx
f0100379:	89 cb                	mov    %ecx,%ebx
f010037b:	83 e3 40             	and    $0x40,%ebx
f010037e:	83 e0 7f             	and    $0x7f,%eax
f0100381:	85 db                	test   %ebx,%ebx
f0100383:	0f 44 d0             	cmove  %eax,%edx
		shift &= ~(shiftcode[data] | E0ESC);
f0100386:	0f b6 d2             	movzbl %dl,%edx
f0100389:	0f b6 82 a0 67 10 f0 	movzbl -0xfef9860(%edx),%eax
f0100390:	83 c8 40             	or     $0x40,%eax
f0100393:	0f b6 c0             	movzbl %al,%eax
f0100396:	f7 d0                	not    %eax
f0100398:	21 c8                	and    %ecx,%eax
f010039a:	a3 00 70 21 f0       	mov    %eax,0xf0217000
		return 0;
f010039f:	bb 00 00 00 00       	mov    $0x0,%ebx
f01003a4:	eb c6                	jmp    f010036c <kbd_proc_data+0x9a>
		else if ('A' <= c && c <= 'Z')
f01003a6:	83 ea 41             	sub    $0x41,%edx
			c += 'a' - 'A';
f01003a9:	8d 4b 20             	lea    0x20(%ebx),%ecx
f01003ac:	83 fa 1a             	cmp    $0x1a,%edx
f01003af:	0f 42 d9             	cmovb  %ecx,%ebx
	if (!(~shift & (CTL | ALT)) && c == KEY_DEL) {
f01003b2:	f7 d0                	not    %eax
f01003b4:	a8 06                	test   $0x6,%al
f01003b6:	75 b4                	jne    f010036c <kbd_proc_data+0x9a>
f01003b8:	81 fb e9 00 00 00    	cmp    $0xe9,%ebx
f01003be:	75 ac                	jne    f010036c <kbd_proc_data+0x9a>
		cprintf("Rebooting!\n");
f01003c0:	83 ec 0c             	sub    $0xc,%esp
f01003c3:	68 43 66 10 f0       	push   $0xf0106643
f01003c8:	e8 10 34 00 00       	call   f01037dd <cprintf>
	asm volatile("outb %0,%w1" : : "a" (data), "d" (port));
f01003cd:	b8 03 00 00 00       	mov    $0x3,%eax
f01003d2:	ba 92 00 00 00       	mov    $0x92,%edx
f01003d7:	ee                   	out    %al,(%dx)
}
f01003d8:	83 c4 10             	add    $0x10,%esp
f01003db:	eb 8f                	jmp    f010036c <kbd_proc_data+0x9a>
		return -1;
f01003dd:	bb ff ff ff ff       	mov    $0xffffffff,%ebx
f01003e2:	eb 88                	jmp    f010036c <kbd_proc_data+0x9a>
		return -1;
f01003e4:	bb ff ff ff ff       	mov    $0xffffffff,%ebx
f01003e9:	eb 81                	jmp    f010036c <kbd_proc_data+0x9a>

f01003eb <cons_putc>:
}

// output a character to the console
static void
cons_putc(int c)
{
f01003eb:	55                   	push   %ebp
f01003ec:	89 e5                	mov    %esp,%ebp
f01003ee:	57                   	push   %edi
f01003ef:	56                   	push   %esi
f01003f0:	53                   	push   %ebx
f01003f1:	83 ec 1c             	sub    $0x1c,%esp
f01003f4:	89 c1                	mov    %eax,%ecx
	for (i = 0;
f01003f6:	be 00 00 00 00       	mov    $0x0,%esi
	asm volatile("inb %w1,%0" : "=a" (data) : "d" (port));
f01003fb:	bf fd 03 00 00       	mov    $0x3fd,%edi
f0100400:	bb 84 00 00 00       	mov    $0x84,%ebx
f0100405:	89 fa                	mov    %edi,%edx
f0100407:	ec                   	in     (%dx),%al
	     !(inb(COM1 + COM_LSR) & COM_LSR_TXRDY) && i < 12800;
f0100408:	a8 20                	test   $0x20,%al
f010040a:	75 13                	jne    f010041f <cons_putc+0x34>
f010040c:	81 fe ff 31 00 00    	cmp    $0x31ff,%esi
f0100412:	7f 0b                	jg     f010041f <cons_putc+0x34>
f0100414:	89 da                	mov    %ebx,%edx
f0100416:	ec                   	in     (%dx),%al
f0100417:	ec                   	in     (%dx),%al
f0100418:	ec                   	in     (%dx),%al
f0100419:	ec                   	in     (%dx),%al
	     i++)
f010041a:	83 c6 01             	add    $0x1,%esi
f010041d:	eb e6                	jmp    f0100405 <cons_putc+0x1a>
	outb(COM1 + COM_TX, c);
f010041f:	88 4d e7             	mov    %cl,-0x19(%ebp)
	asm volatile("outb %0,%w1" : : "a" (data), "d" (port));
f0100422:	ba f8 03 00 00       	mov    $0x3f8,%edx
f0100427:	89 c8                	mov    %ecx,%eax
f0100429:	ee                   	out    %al,(%dx)
	for (i = 0; !(inb(0x378+1) & 0x80) && i < 12800; i++)
f010042a:	be 00 00 00 00       	mov    $0x0,%esi
	asm volatile("inb %w1,%0" : "=a" (data) : "d" (port));
f010042f:	bf 79 03 00 00       	mov    $0x379,%edi
f0100434:	bb 84 00 00 00       	mov    $0x84,%ebx
f0100439:	89 fa                	mov    %edi,%edx
f010043b:	ec                   	in     (%dx),%al
f010043c:	81 fe ff 31 00 00    	cmp    $0x31ff,%esi
f0100442:	7f 0f                	jg     f0100453 <cons_putc+0x68>
f0100444:	84 c0                	test   %al,%al
f0100446:	78 0b                	js     f0100453 <cons_putc+0x68>
f0100448:	89 da                	mov    %ebx,%edx
f010044a:	ec                   	in     (%dx),%al
f010044b:	ec                   	in     (%dx),%al
f010044c:	ec                   	in     (%dx),%al
f010044d:	ec                   	in     (%dx),%al
f010044e:	83 c6 01             	add    $0x1,%esi
f0100451:	eb e6                	jmp    f0100439 <cons_putc+0x4e>
	asm volatile("outb %0,%w1" : : "a" (data), "d" (port));
f0100453:	ba 78 03 00 00       	mov    $0x378,%edx
f0100458:	0f b6 45 e7          	movzbl -0x19(%ebp),%eax
f010045c:	ee                   	out    %al,(%dx)
f010045d:	ba 7a 03 00 00       	mov    $0x37a,%edx
f0100462:	b8 0d 00 00 00       	mov    $0xd,%eax
f0100467:	ee                   	out    %al,(%dx)
f0100468:	b8 08 00 00 00       	mov    $0x8,%eax
f010046d:	ee                   	out    %al,(%dx)
		c |= 0x0700;
f010046e:	89 c8                	mov    %ecx,%eax
f0100470:	80 cc 07             	or     $0x7,%ah
f0100473:	f7 c1 00 ff ff ff    	test   $0xffffff00,%ecx
f0100479:	0f 44 c8             	cmove  %eax,%ecx
	switch (c & 0xff) {
f010047c:	0f b6 c1             	movzbl %cl,%eax
f010047f:	80 f9 0a             	cmp    $0xa,%cl
f0100482:	0f 84 dd 00 00 00    	je     f0100565 <cons_putc+0x17a>
f0100488:	83 f8 0a             	cmp    $0xa,%eax
f010048b:	7f 46                	jg     f01004d3 <cons_putc+0xe8>
f010048d:	83 f8 08             	cmp    $0x8,%eax
f0100490:	0f 84 a7 00 00 00    	je     f010053d <cons_putc+0x152>
f0100496:	83 f8 09             	cmp    $0x9,%eax
f0100499:	0f 85 d3 00 00 00    	jne    f0100572 <cons_putc+0x187>
		cons_putc(' ');
f010049f:	b8 20 00 00 00       	mov    $0x20,%eax
f01004a4:	e8 42 ff ff ff       	call   f01003eb <cons_putc>
		cons_putc(' ');
f01004a9:	b8 20 00 00 00       	mov    $0x20,%eax
f01004ae:	e8 38 ff ff ff       	call   f01003eb <cons_putc>
		cons_putc(' ');
f01004b3:	b8 20 00 00 00       	mov    $0x20,%eax
f01004b8:	e8 2e ff ff ff       	call   f01003eb <cons_putc>
		cons_putc(' ');
f01004bd:	b8 20 00 00 00       	mov    $0x20,%eax
f01004c2:	e8 24 ff ff ff       	call   f01003eb <cons_putc>
		cons_putc(' ');
f01004c7:	b8 20 00 00 00       	mov    $0x20,%eax
f01004cc:	e8 1a ff ff ff       	call   f01003eb <cons_putc>
		break;
f01004d1:	eb 25                	jmp    f01004f8 <cons_putc+0x10d>
	switch (c & 0xff) {
f01004d3:	83 f8 0d             	cmp    $0xd,%eax
f01004d6:	0f 85 96 00 00 00    	jne    f0100572 <cons_putc+0x187>
		crt_pos -= (crt_pos % CRT_COLS);
f01004dc:	0f b7 05 28 72 21 f0 	movzwl 0xf0217228,%eax
f01004e3:	69 c0 cd cc 00 00    	imul   $0xcccd,%eax,%eax
f01004e9:	c1 e8 16             	shr    $0x16,%eax
f01004ec:	8d 04 80             	lea    (%eax,%eax,4),%eax
f01004ef:	c1 e0 04             	shl    $0x4,%eax
f01004f2:	66 a3 28 72 21 f0    	mov    %ax,0xf0217228
	if (crt_pos >= CRT_SIZE) {
f01004f8:	66 81 3d 28 72 21 f0 	cmpw   $0x7cf,0xf0217228
f01004ff:	cf 07 
f0100501:	0f 87 8e 00 00 00    	ja     f0100595 <cons_putc+0x1aa>
	outb(addr_6845, 14);
f0100507:	8b 0d 30 72 21 f0    	mov    0xf0217230,%ecx
f010050d:	b8 0e 00 00 00       	mov    $0xe,%eax
f0100512:	89 ca                	mov    %ecx,%edx
f0100514:	ee                   	out    %al,(%dx)
	outb(addr_6845 + 1, crt_pos >> 8);
f0100515:	0f b7 1d 28 72 21 f0 	movzwl 0xf0217228,%ebx
f010051c:	8d 71 01             	lea    0x1(%ecx),%esi
f010051f:	89 d8                	mov    %ebx,%eax
f0100521:	66 c1 e8 08          	shr    $0x8,%ax
f0100525:	89 f2                	mov    %esi,%edx
f0100527:	ee                   	out    %al,(%dx)
f0100528:	b8 0f 00 00 00       	mov    $0xf,%eax
f010052d:	89 ca                	mov    %ecx,%edx
f010052f:	ee                   	out    %al,(%dx)
f0100530:	89 d8                	mov    %ebx,%eax
f0100532:	89 f2                	mov    %esi,%edx
f0100534:	ee                   	out    %al,(%dx)
	serial_putc(c);
	lpt_putc(c);
	cga_putc(c);
}
f0100535:	8d 65 f4             	lea    -0xc(%ebp),%esp
f0100538:	5b                   	pop    %ebx
f0100539:	5e                   	pop    %esi
f010053a:	5f                   	pop    %edi
f010053b:	5d                   	pop    %ebp
f010053c:	c3                   	ret    
		if (crt_pos > 0) {
f010053d:	0f b7 05 28 72 21 f0 	movzwl 0xf0217228,%eax
f0100544:	66 85 c0             	test   %ax,%ax
f0100547:	74 be                	je     f0100507 <cons_putc+0x11c>
			crt_pos--;
f0100549:	83 e8 01             	sub    $0x1,%eax
f010054c:	66 a3 28 72 21 f0    	mov    %ax,0xf0217228
			crt_buf[crt_pos] = (c & ~0xff) | ' ';
f0100552:	0f b7 d0             	movzwl %ax,%edx
f0100555:	b1 00                	mov    $0x0,%cl
f0100557:	83 c9 20             	or     $0x20,%ecx
f010055a:	a1 2c 72 21 f0       	mov    0xf021722c,%eax
f010055f:	66 89 0c 50          	mov    %cx,(%eax,%edx,2)
f0100563:	eb 93                	jmp    f01004f8 <cons_putc+0x10d>
		crt_pos += CRT_COLS;
f0100565:	66 83 05 28 72 21 f0 	addw   $0x50,0xf0217228
f010056c:	50 
f010056d:	e9 6a ff ff ff       	jmp    f01004dc <cons_putc+0xf1>
		crt_buf[crt_pos++] = c;		/* write the character */
f0100572:	0f b7 05 28 72 21 f0 	movzwl 0xf0217228,%eax
f0100579:	8d 50 01             	lea    0x1(%eax),%edx
f010057c:	66 89 15 28 72 21 f0 	mov    %dx,0xf0217228
f0100583:	0f b7 c0             	movzwl %ax,%eax
f0100586:	8b 15 2c 72 21 f0    	mov    0xf021722c,%edx
f010058c:	66 89 0c 42          	mov    %cx,(%edx,%eax,2)
		break;
f0100590:	e9 63 ff ff ff       	jmp    f01004f8 <cons_putc+0x10d>
		memmove(crt_buf, crt_buf + CRT_COLS, (CRT_SIZE - CRT_COLS) * sizeof(uint16_t));
f0100595:	a1 2c 72 21 f0       	mov    0xf021722c,%eax
f010059a:	83 ec 04             	sub    $0x4,%esp
f010059d:	68 00 0f 00 00       	push   $0xf00
f01005a2:	8d 90 a0 00 00 00    	lea    0xa0(%eax),%edx
f01005a8:	52                   	push   %edx
f01005a9:	50                   	push   %eax
f01005aa:	e8 87 53 00 00       	call   f0105936 <memmove>
			crt_buf[i] = 0x0700 | ' ';
f01005af:	8b 15 2c 72 21 f0    	mov    0xf021722c,%edx
f01005b5:	8d 82 00 0f 00 00    	lea    0xf00(%edx),%eax
f01005bb:	81 c2 a0 0f 00 00    	add    $0xfa0,%edx
f01005c1:	83 c4 10             	add    $0x10,%esp
f01005c4:	66 c7 00 20 07       	movw   $0x720,(%eax)
f01005c9:	83 c0 02             	add    $0x2,%eax
		for (i = CRT_SIZE - CRT_COLS; i < CRT_SIZE; i++)
f01005cc:	39 d0                	cmp    %edx,%eax
f01005ce:	75 f4                	jne    f01005c4 <cons_putc+0x1d9>
		crt_pos -= CRT_COLS;
f01005d0:	66 83 2d 28 72 21 f0 	subw   $0x50,0xf0217228
f01005d7:	50 
f01005d8:	e9 2a ff ff ff       	jmp    f0100507 <cons_putc+0x11c>

f01005dd <serial_intr>:
{
f01005dd:	f3 0f 1e fb          	endbr32 
	if (serial_exists)
f01005e1:	80 3d 34 72 21 f0 00 	cmpb   $0x0,0xf0217234
f01005e8:	75 01                	jne    f01005eb <serial_intr+0xe>
f01005ea:	c3                   	ret    
{
f01005eb:	55                   	push   %ebp
f01005ec:	89 e5                	mov    %esp,%ebp
f01005ee:	83 ec 08             	sub    $0x8,%esp
		cons_intr(serial_proc_data);
f01005f1:	b8 75 02 10 f0       	mov    $0xf0100275,%eax
f01005f6:	e8 98 fc ff ff       	call   f0100293 <cons_intr>
}
f01005fb:	c9                   	leave  
f01005fc:	c3                   	ret    

f01005fd <kbd_intr>:
{
f01005fd:	f3 0f 1e fb          	endbr32 
f0100601:	55                   	push   %ebp
f0100602:	89 e5                	mov    %esp,%ebp
f0100604:	83 ec 08             	sub    $0x8,%esp
	cons_intr(kbd_proc_data);
f0100607:	b8 d2 02 10 f0       	mov    $0xf01002d2,%eax
f010060c:	e8 82 fc ff ff       	call   f0100293 <cons_intr>
}
f0100611:	c9                   	leave  
f0100612:	c3                   	ret    

f0100613 <cons_getc>:
{
f0100613:	f3 0f 1e fb          	endbr32 
f0100617:	55                   	push   %ebp
f0100618:	89 e5                	mov    %esp,%ebp
f010061a:	83 ec 08             	sub    $0x8,%esp
	serial_intr();
f010061d:	e8 bb ff ff ff       	call   f01005dd <serial_intr>
	kbd_intr();
f0100622:	e8 d6 ff ff ff       	call   f01005fd <kbd_intr>
	if (cons.rpos != cons.wpos) {
f0100627:	a1 20 72 21 f0       	mov    0xf0217220,%eax
	return 0;
f010062c:	ba 00 00 00 00       	mov    $0x0,%edx
	if (cons.rpos != cons.wpos) {
f0100631:	3b 05 24 72 21 f0    	cmp    0xf0217224,%eax
f0100637:	74 1c                	je     f0100655 <cons_getc+0x42>
		c = cons.buf[cons.rpos++];
f0100639:	8d 48 01             	lea    0x1(%eax),%ecx
f010063c:	0f b6 90 20 70 21 f0 	movzbl -0xfde8fe0(%eax),%edx
			cons.rpos = 0;
f0100643:	3d ff 01 00 00       	cmp    $0x1ff,%eax
f0100648:	b8 00 00 00 00       	mov    $0x0,%eax
f010064d:	0f 45 c1             	cmovne %ecx,%eax
f0100650:	a3 20 72 21 f0       	mov    %eax,0xf0217220
}
f0100655:	89 d0                	mov    %edx,%eax
f0100657:	c9                   	leave  
f0100658:	c3                   	ret    

f0100659 <cons_init>:

// initialize the console devices
void
cons_init(void)
{
f0100659:	f3 0f 1e fb          	endbr32 
f010065d:	55                   	push   %ebp
f010065e:	89 e5                	mov    %esp,%ebp
f0100660:	57                   	push   %edi
f0100661:	56                   	push   %esi
f0100662:	53                   	push   %ebx
f0100663:	83 ec 0c             	sub    $0xc,%esp
	was = *cp;
f0100666:	0f b7 15 00 80 0b f0 	movzwl 0xf00b8000,%edx
	*cp = (uint16_t) 0xA55A;
f010066d:	66 c7 05 00 80 0b f0 	movw   $0xa55a,0xf00b8000
f0100674:	5a a5 
	if (*cp != 0xA55A) {
f0100676:	0f b7 05 00 80 0b f0 	movzwl 0xf00b8000,%eax
f010067d:	66 3d 5a a5          	cmp    $0xa55a,%ax
f0100681:	0f 84 de 00 00 00    	je     f0100765 <cons_init+0x10c>
		addr_6845 = MONO_BASE;
f0100687:	c7 05 30 72 21 f0 b4 	movl   $0x3b4,0xf0217230
f010068e:	03 00 00 
		cp = (uint16_t*) (KERNBASE + MONO_BUF);
f0100691:	be 00 00 0b f0       	mov    $0xf00b0000,%esi
	outb(addr_6845, 14);
f0100696:	8b 3d 30 72 21 f0    	mov    0xf0217230,%edi
f010069c:	b8 0e 00 00 00       	mov    $0xe,%eax
f01006a1:	89 fa                	mov    %edi,%edx
f01006a3:	ee                   	out    %al,(%dx)
	pos = inb(addr_6845 + 1) << 8;
f01006a4:	8d 4f 01             	lea    0x1(%edi),%ecx
	asm volatile("inb %w1,%0" : "=a" (data) : "d" (port));
f01006a7:	89 ca                	mov    %ecx,%edx
f01006a9:	ec                   	in     (%dx),%al
f01006aa:	0f b6 c0             	movzbl %al,%eax
f01006ad:	c1 e0 08             	shl    $0x8,%eax
f01006b0:	89 c3                	mov    %eax,%ebx
	asm volatile("outb %0,%w1" : : "a" (data), "d" (port));
f01006b2:	b8 0f 00 00 00       	mov    $0xf,%eax
f01006b7:	89 fa                	mov    %edi,%edx
f01006b9:	ee                   	out    %al,(%dx)
	asm volatile("inb %w1,%0" : "=a" (data) : "d" (port));
f01006ba:	89 ca                	mov    %ecx,%edx
f01006bc:	ec                   	in     (%dx),%al
	crt_buf = (uint16_t*) cp;
f01006bd:	89 35 2c 72 21 f0    	mov    %esi,0xf021722c
	pos |= inb(addr_6845 + 1);
f01006c3:	0f b6 c0             	movzbl %al,%eax
f01006c6:	09 d8                	or     %ebx,%eax
	crt_pos = pos;
f01006c8:	66 a3 28 72 21 f0    	mov    %ax,0xf0217228
	kbd_intr();
f01006ce:	e8 2a ff ff ff       	call   f01005fd <kbd_intr>
	irq_setmask_8259A(irq_mask_8259A & ~(1<<IRQ_KBD));
f01006d3:	83 ec 0c             	sub    $0xc,%esp
f01006d6:	0f b7 05 a8 33 12 f0 	movzwl 0xf01233a8,%eax
f01006dd:	25 fd ff 00 00       	and    $0xfffd,%eax
f01006e2:	50                   	push   %eax
f01006e3:	e8 88 2f 00 00       	call   f0103670 <irq_setmask_8259A>
	asm volatile("outb %0,%w1" : : "a" (data), "d" (port));
f01006e8:	bb 00 00 00 00       	mov    $0x0,%ebx
f01006ed:	b9 fa 03 00 00       	mov    $0x3fa,%ecx
f01006f2:	89 d8                	mov    %ebx,%eax
f01006f4:	89 ca                	mov    %ecx,%edx
f01006f6:	ee                   	out    %al,(%dx)
f01006f7:	bf fb 03 00 00       	mov    $0x3fb,%edi
f01006fc:	b8 80 ff ff ff       	mov    $0xffffff80,%eax
f0100701:	89 fa                	mov    %edi,%edx
f0100703:	ee                   	out    %al,(%dx)
f0100704:	b8 0c 00 00 00       	mov    $0xc,%eax
f0100709:	ba f8 03 00 00       	mov    $0x3f8,%edx
f010070e:	ee                   	out    %al,(%dx)
f010070f:	be f9 03 00 00       	mov    $0x3f9,%esi
f0100714:	89 d8                	mov    %ebx,%eax
f0100716:	89 f2                	mov    %esi,%edx
f0100718:	ee                   	out    %al,(%dx)
f0100719:	b8 03 00 00 00       	mov    $0x3,%eax
f010071e:	89 fa                	mov    %edi,%edx
f0100720:	ee                   	out    %al,(%dx)
f0100721:	ba fc 03 00 00       	mov    $0x3fc,%edx
f0100726:	89 d8                	mov    %ebx,%eax
f0100728:	ee                   	out    %al,(%dx)
f0100729:	b8 01 00 00 00       	mov    $0x1,%eax
f010072e:	89 f2                	mov    %esi,%edx
f0100730:	ee                   	out    %al,(%dx)
	asm volatile("inb %w1,%0" : "=a" (data) : "d" (port));
f0100731:	ba fd 03 00 00       	mov    $0x3fd,%edx
f0100736:	ec                   	in     (%dx),%al
f0100737:	89 c3                	mov    %eax,%ebx
	serial_exists = (inb(COM1+COM_LSR) != 0xFF);
f0100739:	83 c4 10             	add    $0x10,%esp
f010073c:	3c ff                	cmp    $0xff,%al
f010073e:	0f 95 05 34 72 21 f0 	setne  0xf0217234
f0100745:	89 ca                	mov    %ecx,%edx
f0100747:	ec                   	in     (%dx),%al
f0100748:	ba f8 03 00 00       	mov    $0x3f8,%edx
f010074d:	ec                   	in     (%dx),%al
	if (serial_exists)
f010074e:	80 fb ff             	cmp    $0xff,%bl
f0100751:	75 2d                	jne    f0100780 <cons_init+0x127>
	cga_init();
	kbd_init();
	serial_init();

	if (!serial_exists)
		cprintf("Serial port does not exist!\n");
f0100753:	83 ec 0c             	sub    $0xc,%esp
f0100756:	68 4f 66 10 f0       	push   $0xf010664f
f010075b:	e8 7d 30 00 00       	call   f01037dd <cprintf>
f0100760:	83 c4 10             	add    $0x10,%esp
}
f0100763:	eb 3c                	jmp    f01007a1 <cons_init+0x148>
		*cp = was;
f0100765:	66 89 15 00 80 0b f0 	mov    %dx,0xf00b8000
		addr_6845 = CGA_BASE;
f010076c:	c7 05 30 72 21 f0 d4 	movl   $0x3d4,0xf0217230
f0100773:	03 00 00 
	cp = (uint16_t*) (KERNBASE + CGA_BUF);
f0100776:	be 00 80 0b f0       	mov    $0xf00b8000,%esi
f010077b:	e9 16 ff ff ff       	jmp    f0100696 <cons_init+0x3d>
		irq_setmask_8259A(irq_mask_8259A & ~(1<<IRQ_SERIAL));
f0100780:	83 ec 0c             	sub    $0xc,%esp
f0100783:	0f b7 05 a8 33 12 f0 	movzwl 0xf01233a8,%eax
f010078a:	25 ef ff 00 00       	and    $0xffef,%eax
f010078f:	50                   	push   %eax
f0100790:	e8 db 2e 00 00       	call   f0103670 <irq_setmask_8259A>
	if (!serial_exists)
f0100795:	83 c4 10             	add    $0x10,%esp
f0100798:	80 3d 34 72 21 f0 00 	cmpb   $0x0,0xf0217234
f010079f:	74 b2                	je     f0100753 <cons_init+0xfa>
}
f01007a1:	8d 65 f4             	lea    -0xc(%ebp),%esp
f01007a4:	5b                   	pop    %ebx
f01007a5:	5e                   	pop    %esi
f01007a6:	5f                   	pop    %edi
f01007a7:	5d                   	pop    %ebp
f01007a8:	c3                   	ret    

f01007a9 <cputchar>:

// `High'-level console I/O.  Used by readline and cprintf.

void
cputchar(int c)
{
f01007a9:	f3 0f 1e fb          	endbr32 
f01007ad:	55                   	push   %ebp
f01007ae:	89 e5                	mov    %esp,%ebp
f01007b0:	83 ec 08             	sub    $0x8,%esp
	cons_putc(c);
f01007b3:	8b 45 08             	mov    0x8(%ebp),%eax
f01007b6:	e8 30 fc ff ff       	call   f01003eb <cons_putc>
}
f01007bb:	c9                   	leave  
f01007bc:	c3                   	ret    

f01007bd <getchar>:

int
getchar(void)
{
f01007bd:	f3 0f 1e fb          	endbr32 
f01007c1:	55                   	push   %ebp
f01007c2:	89 e5                	mov    %esp,%ebp
f01007c4:	83 ec 08             	sub    $0x8,%esp
	int c;

	while ((c = cons_getc()) == 0)
f01007c7:	e8 47 fe ff ff       	call   f0100613 <cons_getc>
f01007cc:	85 c0                	test   %eax,%eax
f01007ce:	74 f7                	je     f01007c7 <getchar+0xa>
		/* do nothing */;
	return c;
}
f01007d0:	c9                   	leave  
f01007d1:	c3                   	ret    

f01007d2 <iscons>:

int
iscons(int fdnum)
{
f01007d2:	f3 0f 1e fb          	endbr32 
	// used by readline
	return 1;
}
f01007d6:	b8 01 00 00 00       	mov    $0x1,%eax
f01007db:	c3                   	ret    

f01007dc <mon_help>:

/***** Implementations of basic kernel monitor commands *****/

int
mon_help(int argc, char **argv, struct Trapframe *tf)
{
f01007dc:	f3 0f 1e fb          	endbr32 
f01007e0:	55                   	push   %ebp
f01007e1:	89 e5                	mov    %esp,%ebp
f01007e3:	83 ec 0c             	sub    $0xc,%esp
	int i;

	for (i = 0; i < ARRAY_SIZE(commands); i++)
		cprintf("%s - %s\n", commands[i].name, commands[i].desc);
f01007e6:	68 a0 68 10 f0       	push   $0xf01068a0
f01007eb:	68 be 68 10 f0       	push   $0xf01068be
f01007f0:	68 c3 68 10 f0       	push   $0xf01068c3
f01007f5:	e8 e3 2f 00 00       	call   f01037dd <cprintf>
f01007fa:	83 c4 0c             	add    $0xc,%esp
f01007fd:	68 2c 69 10 f0       	push   $0xf010692c
f0100802:	68 cc 68 10 f0       	push   $0xf01068cc
f0100807:	68 c3 68 10 f0       	push   $0xf01068c3
f010080c:	e8 cc 2f 00 00       	call   f01037dd <cprintf>
	return 0;
}
f0100811:	b8 00 00 00 00       	mov    $0x0,%eax
f0100816:	c9                   	leave  
f0100817:	c3                   	ret    

f0100818 <mon_kerninfo>:

int
mon_kerninfo(int argc, char **argv, struct Trapframe *tf)
{
f0100818:	f3 0f 1e fb          	endbr32 
f010081c:	55                   	push   %ebp
f010081d:	89 e5                	mov    %esp,%ebp
f010081f:	83 ec 14             	sub    $0x14,%esp
	extern char _start[], entry[], etext[], edata[], end[];

	cprintf("Special kernel symbols:\n");
f0100822:	68 d5 68 10 f0       	push   $0xf01068d5
f0100827:	e8 b1 2f 00 00       	call   f01037dd <cprintf>
	cprintf("  _start                  %08x (phys)\n", _start);
f010082c:	83 c4 08             	add    $0x8,%esp
f010082f:	68 0c 00 10 00       	push   $0x10000c
f0100834:	68 54 69 10 f0       	push   $0xf0106954
f0100839:	e8 9f 2f 00 00       	call   f01037dd <cprintf>
	cprintf("  entry  %08x (virt)  %08x (phys)\n", entry, entry - KERNBASE);
f010083e:	83 c4 0c             	add    $0xc,%esp
f0100841:	68 0c 00 10 00       	push   $0x10000c
f0100846:	68 0c 00 10 f0       	push   $0xf010000c
f010084b:	68 7c 69 10 f0       	push   $0xf010697c
f0100850:	e8 88 2f 00 00       	call   f01037dd <cprintf>
	cprintf("  etext  %08x (virt)  %08x (phys)\n", etext, etext - KERNBASE);
f0100855:	83 c4 0c             	add    $0xc,%esp
f0100858:	68 7d 65 10 00       	push   $0x10657d
f010085d:	68 7d 65 10 f0       	push   $0xf010657d
f0100862:	68 a0 69 10 f0       	push   $0xf01069a0
f0100867:	e8 71 2f 00 00       	call   f01037dd <cprintf>
	cprintf("  edata  %08x (virt)  %08x (phys)\n", edata, edata - KERNBASE);
f010086c:	83 c4 0c             	add    $0xc,%esp
f010086f:	68 00 70 21 00       	push   $0x217000
f0100874:	68 00 70 21 f0       	push   $0xf0217000
f0100879:	68 c4 69 10 f0       	push   $0xf01069c4
f010087e:	e8 5a 2f 00 00       	call   f01037dd <cprintf>
	cprintf("  end    %08x (virt)  %08x (phys)\n", end, end - KERNBASE);
f0100883:	83 c4 0c             	add    $0xc,%esp
f0100886:	68 08 90 25 00       	push   $0x259008
f010088b:	68 08 90 25 f0       	push   $0xf0259008
f0100890:	68 e8 69 10 f0       	push   $0xf01069e8
f0100895:	e8 43 2f 00 00       	call   f01037dd <cprintf>
	cprintf("Kernel executable memory footprint: %dKB\n",
f010089a:	83 c4 08             	add    $0x8,%esp
		ROUNDUP(end - entry, 1024) / 1024);
f010089d:	b8 08 90 25 f0       	mov    $0xf0259008,%eax
f01008a2:	2d 0d fc 0f f0       	sub    $0xf00ffc0d,%eax
	cprintf("Kernel executable memory footprint: %dKB\n",
f01008a7:	c1 f8 0a             	sar    $0xa,%eax
f01008aa:	50                   	push   %eax
f01008ab:	68 0c 6a 10 f0       	push   $0xf0106a0c
f01008b0:	e8 28 2f 00 00       	call   f01037dd <cprintf>
	return 0;
}
f01008b5:	b8 00 00 00 00       	mov    $0x0,%eax
f01008ba:	c9                   	leave  
f01008bb:	c3                   	ret    

f01008bc <mon_backtrace>:

int
mon_backtrace(int argc, char **argv, struct Trapframe *tf)
{
f01008bc:	f3 0f 1e fb          	endbr32 
	// Your code here.
	return 0;
}
f01008c0:	b8 00 00 00 00       	mov    $0x0,%eax
f01008c5:	c3                   	ret    

f01008c6 <monitor>:
	return 0;
}

void
monitor(struct Trapframe *tf)
{
f01008c6:	f3 0f 1e fb          	endbr32 
f01008ca:	55                   	push   %ebp
f01008cb:	89 e5                	mov    %esp,%ebp
f01008cd:	57                   	push   %edi
f01008ce:	56                   	push   %esi
f01008cf:	53                   	push   %ebx
f01008d0:	83 ec 58             	sub    $0x58,%esp
	char *buf;

	cprintf("Welcome to the JOS kernel monitor!\n");
f01008d3:	68 38 6a 10 f0       	push   $0xf0106a38
f01008d8:	e8 00 2f 00 00       	call   f01037dd <cprintf>
	cprintf("Type 'help' for a list of commands.\n");
f01008dd:	c7 04 24 5c 6a 10 f0 	movl   $0xf0106a5c,(%esp)
f01008e4:	e8 f4 2e 00 00       	call   f01037dd <cprintf>

	if (tf != NULL)
f01008e9:	83 c4 10             	add    $0x10,%esp
f01008ec:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
f01008f0:	0f 84 e2 00 00 00    	je     f01009d8 <monitor+0x112>
		print_trapframe(tf);
f01008f6:	83 ec 0c             	sub    $0xc,%esp
f01008f9:	ff 75 08             	pushl  0x8(%ebp)
f01008fc:	e8 ae 36 00 00       	call   f0103faf <print_trapframe>
f0100901:	83 c4 10             	add    $0x10,%esp
f0100904:	e9 cf 00 00 00       	jmp    f01009d8 <monitor+0x112>
		while (*buf && strchr(WHITESPACE, *buf))
f0100909:	83 ec 08             	sub    $0x8,%esp
f010090c:	0f be c0             	movsbl %al,%eax
f010090f:	50                   	push   %eax
f0100910:	68 f2 68 10 f0       	push   $0xf01068f2
f0100915:	e8 8b 4f 00 00       	call   f01058a5 <strchr>
f010091a:	83 c4 10             	add    $0x10,%esp
f010091d:	85 c0                	test   %eax,%eax
f010091f:	74 6c                	je     f010098d <monitor+0xc7>
			*buf++ = 0;
f0100921:	c6 03 00             	movb   $0x0,(%ebx)
f0100924:	89 f7                	mov    %esi,%edi
f0100926:	8d 5b 01             	lea    0x1(%ebx),%ebx
f0100929:	89 fe                	mov    %edi,%esi
		while (*buf && strchr(WHITESPACE, *buf))
f010092b:	0f b6 03             	movzbl (%ebx),%eax
f010092e:	84 c0                	test   %al,%al
f0100930:	75 d7                	jne    f0100909 <monitor+0x43>
	argv[argc] = 0;
f0100932:	c7 44 b5 a8 00 00 00 	movl   $0x0,-0x58(%ebp,%esi,4)
f0100939:	00 
	if (argc == 0)
f010093a:	85 f6                	test   %esi,%esi
f010093c:	0f 84 96 00 00 00    	je     f01009d8 <monitor+0x112>
		if (strcmp(argv[0], commands[i].name) == 0)
f0100942:	83 ec 08             	sub    $0x8,%esp
f0100945:	68 be 68 10 f0       	push   $0xf01068be
f010094a:	ff 75 a8             	pushl  -0x58(%ebp)
f010094d:	e8 ed 4e 00 00       	call   f010583f <strcmp>
f0100952:	83 c4 10             	add    $0x10,%esp
f0100955:	85 c0                	test   %eax,%eax
f0100957:	0f 84 a7 00 00 00    	je     f0100a04 <monitor+0x13e>
f010095d:	83 ec 08             	sub    $0x8,%esp
f0100960:	68 cc 68 10 f0       	push   $0xf01068cc
f0100965:	ff 75 a8             	pushl  -0x58(%ebp)
f0100968:	e8 d2 4e 00 00       	call   f010583f <strcmp>
f010096d:	83 c4 10             	add    $0x10,%esp
f0100970:	85 c0                	test   %eax,%eax
f0100972:	0f 84 87 00 00 00    	je     f01009ff <monitor+0x139>
	cprintf("Unknown command '%s'\n", argv[0]);
f0100978:	83 ec 08             	sub    $0x8,%esp
f010097b:	ff 75 a8             	pushl  -0x58(%ebp)
f010097e:	68 14 69 10 f0       	push   $0xf0106914
f0100983:	e8 55 2e 00 00       	call   f01037dd <cprintf>
	return 0;
f0100988:	83 c4 10             	add    $0x10,%esp
f010098b:	eb 4b                	jmp    f01009d8 <monitor+0x112>
		if (*buf == 0)
f010098d:	80 3b 00             	cmpb   $0x0,(%ebx)
f0100990:	74 a0                	je     f0100932 <monitor+0x6c>
		if (argc == MAXARGS-1) {
f0100992:	83 fe 0f             	cmp    $0xf,%esi
f0100995:	74 2f                	je     f01009c6 <monitor+0x100>
		argv[argc++] = buf;
f0100997:	8d 7e 01             	lea    0x1(%esi),%edi
f010099a:	89 5c b5 a8          	mov    %ebx,-0x58(%ebp,%esi,4)
		while (*buf && !strchr(WHITESPACE, *buf))
f010099e:	0f b6 03             	movzbl (%ebx),%eax
f01009a1:	84 c0                	test   %al,%al
f01009a3:	74 84                	je     f0100929 <monitor+0x63>
f01009a5:	83 ec 08             	sub    $0x8,%esp
f01009a8:	0f be c0             	movsbl %al,%eax
f01009ab:	50                   	push   %eax
f01009ac:	68 f2 68 10 f0       	push   $0xf01068f2
f01009b1:	e8 ef 4e 00 00       	call   f01058a5 <strchr>
f01009b6:	83 c4 10             	add    $0x10,%esp
f01009b9:	85 c0                	test   %eax,%eax
f01009bb:	0f 85 68 ff ff ff    	jne    f0100929 <monitor+0x63>
			buf++;
f01009c1:	83 c3 01             	add    $0x1,%ebx
f01009c4:	eb d8                	jmp    f010099e <monitor+0xd8>
			cprintf("Too many arguments (max %d)\n", MAXARGS);
f01009c6:	83 ec 08             	sub    $0x8,%esp
f01009c9:	6a 10                	push   $0x10
f01009cb:	68 f7 68 10 f0       	push   $0xf01068f7
f01009d0:	e8 08 2e 00 00       	call   f01037dd <cprintf>
			return 0;
f01009d5:	83 c4 10             	add    $0x10,%esp

	while (1) {
		buf = readline("K> ");
f01009d8:	83 ec 0c             	sub    $0xc,%esp
f01009db:	68 ee 68 10 f0       	push   $0xf01068ee
f01009e0:	e8 66 4c 00 00       	call   f010564b <readline>
f01009e5:	89 c3                	mov    %eax,%ebx
		if (buf != NULL)
f01009e7:	83 c4 10             	add    $0x10,%esp
f01009ea:	85 c0                	test   %eax,%eax
f01009ec:	74 ea                	je     f01009d8 <monitor+0x112>
	argv[argc] = 0;
f01009ee:	c7 45 a8 00 00 00 00 	movl   $0x0,-0x58(%ebp)
	argc = 0;
f01009f5:	be 00 00 00 00       	mov    $0x0,%esi
f01009fa:	e9 2c ff ff ff       	jmp    f010092b <monitor+0x65>
	for (i = 0; i < ARRAY_SIZE(commands); i++) {
f01009ff:	b8 01 00 00 00       	mov    $0x1,%eax
			return commands[i].func(argc, argv, tf);
f0100a04:	83 ec 04             	sub    $0x4,%esp
f0100a07:	8d 04 40             	lea    (%eax,%eax,2),%eax
f0100a0a:	ff 75 08             	pushl  0x8(%ebp)
f0100a0d:	8d 55 a8             	lea    -0x58(%ebp),%edx
f0100a10:	52                   	push   %edx
f0100a11:	56                   	push   %esi
f0100a12:	ff 14 85 8c 6a 10 f0 	call   *-0xfef9574(,%eax,4)
			if (runcmd(buf, tf) < 0)
f0100a19:	83 c4 10             	add    $0x10,%esp
f0100a1c:	85 c0                	test   %eax,%eax
f0100a1e:	79 b8                	jns    f01009d8 <monitor+0x112>
				break;
	}
}
f0100a20:	8d 65 f4             	lea    -0xc(%ebp),%esp
f0100a23:	5b                   	pop    %ebx
f0100a24:	5e                   	pop    %esi
f0100a25:	5f                   	pop    %edi
f0100a26:	5d                   	pop    %ebp
f0100a27:	c3                   	ret    

f0100a28 <boot_alloc>:
	// the first virtual address that the linker did *not* assign
	// to any kernel code or global variables.
	/*
	'end'是链接器自动生成的魔术符号，它指向内核的bss段的末尾：链接器未分配给任何内核代码或全局变量的第一个虚拟地址。
	*/
	if (!nextfree) {
f0100a28:	83 3d 38 72 21 f0 00 	cmpl   $0x0,0xf0217238
f0100a2f:	74 1a                	je     f0100a4b <boot_alloc+0x23>
	// nextfree.  Make sure nextfree is kept aligned
	// to a multiple of PGSIZE.
	//
	// LAB 2: Your code here.
	//result指向nextfree即可。
	result=nextfree;
f0100a31:	8b 15 38 72 21 f0    	mov    0xf0217238,%edx
	//更新nextfree指针地址。移动n个字节单位，向上对齐。
	nextfree=ROUNDUP(nextfree+n,PGSIZE);
f0100a37:	8d 84 02 ff 0f 00 00 	lea    0xfff(%edx,%eax,1),%eax
f0100a3e:	25 00 f0 ff ff       	and    $0xfffff000,%eax
f0100a43:	a3 38 72 21 f0       	mov    %eax,0xf0217238
    //返回空闲地址即可。
	return result;
}
f0100a48:	89 d0                	mov    %edx,%eax
f0100a4a:	c3                   	ret    
		nextfree = ROUNDUP((char *) end, PGSIZE);
f0100a4b:	ba 07 a0 25 f0       	mov    $0xf025a007,%edx
f0100a50:	81 e2 00 f0 ff ff    	and    $0xfffff000,%edx
f0100a56:	89 15 38 72 21 f0    	mov    %edx,0xf0217238
f0100a5c:	eb d3                	jmp    f0100a31 <boot_alloc+0x9>

f0100a5e <nvram_read>:
{
f0100a5e:	55                   	push   %ebp
f0100a5f:	89 e5                	mov    %esp,%ebp
f0100a61:	56                   	push   %esi
f0100a62:	53                   	push   %ebx
f0100a63:	89 c3                	mov    %eax,%ebx
	return mc146818_read(r) | (mc146818_read(r + 1) << 8);
f0100a65:	83 ec 0c             	sub    $0xc,%esp
f0100a68:	50                   	push   %eax
f0100a69:	e8 cc 2b 00 00       	call   f010363a <mc146818_read>
f0100a6e:	89 c6                	mov    %eax,%esi
f0100a70:	83 c3 01             	add    $0x1,%ebx
f0100a73:	89 1c 24             	mov    %ebx,(%esp)
f0100a76:	e8 bf 2b 00 00       	call   f010363a <mc146818_read>
f0100a7b:	c1 e0 08             	shl    $0x8,%eax
f0100a7e:	09 f0                	or     %esi,%eax
}
f0100a80:	8d 65 f8             	lea    -0x8(%ebp),%esp
f0100a83:	5b                   	pop    %ebx
f0100a84:	5e                   	pop    %esi
f0100a85:	5d                   	pop    %ebp
f0100a86:	c3                   	ret    

f0100a87 <check_va2pa>:
static physaddr_t
check_va2pa(pde_t *pgdir, uintptr_t va)
{
	pte_t *p;

	pgdir = &pgdir[PDX(va)];
f0100a87:	89 d1                	mov    %edx,%ecx
f0100a89:	c1 e9 16             	shr    $0x16,%ecx
	if (!(*pgdir & PTE_P))
f0100a8c:	8b 04 88             	mov    (%eax,%ecx,4),%eax
f0100a8f:	a8 01                	test   $0x1,%al
f0100a91:	74 51                	je     f0100ae4 <check_va2pa+0x5d>
		return ~0;
	p = (pte_t*) KADDR(PTE_ADDR(*pgdir));
f0100a93:	89 c1                	mov    %eax,%ecx
f0100a95:	81 e1 00 f0 ff ff    	and    $0xfffff000,%ecx
	if (PGNUM(pa) >= npages)
f0100a9b:	c1 e8 0c             	shr    $0xc,%eax
f0100a9e:	3b 05 88 7e 21 f0    	cmp    0xf0217e88,%eax
f0100aa4:	73 23                	jae    f0100ac9 <check_va2pa+0x42>
	if (!(p[PTX(va)] & PTE_P))
f0100aa6:	c1 ea 0c             	shr    $0xc,%edx
f0100aa9:	81 e2 ff 03 00 00    	and    $0x3ff,%edx
f0100aaf:	8b 94 91 00 00 00 f0 	mov    -0x10000000(%ecx,%edx,4),%edx
		return ~0;
	return PTE_ADDR(p[PTX(va)]);
f0100ab6:	89 d0                	mov    %edx,%eax
f0100ab8:	25 00 f0 ff ff       	and    $0xfffff000,%eax
f0100abd:	f6 c2 01             	test   $0x1,%dl
f0100ac0:	ba ff ff ff ff       	mov    $0xffffffff,%edx
f0100ac5:	0f 44 c2             	cmove  %edx,%eax
f0100ac8:	c3                   	ret    
{
f0100ac9:	55                   	push   %ebp
f0100aca:	89 e5                	mov    %esp,%ebp
f0100acc:	83 ec 08             	sub    $0x8,%esp
		_panic(file, line, "KADDR called with invalid pa %08lx", pa);
f0100acf:	51                   	push   %ecx
f0100ad0:	68 a4 65 10 f0       	push   $0xf01065a4
f0100ad5:	68 ba 03 00 00       	push   $0x3ba
f0100ada:	68 21 74 10 f0       	push   $0xf0107421
f0100adf:	e8 5c f5 ff ff       	call   f0100040 <_panic>
		return ~0;
f0100ae4:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
}
f0100ae9:	c3                   	ret    

f0100aea <check_page_free_list>:
{
f0100aea:	55                   	push   %ebp
f0100aeb:	89 e5                	mov    %esp,%ebp
f0100aed:	57                   	push   %edi
f0100aee:	56                   	push   %esi
f0100aef:	53                   	push   %ebx
f0100af0:	83 ec 2c             	sub    $0x2c,%esp
	unsigned pdx_limit = only_low_memory ? 1 : NPDENTRIES;
f0100af3:	84 c0                	test   %al,%al
f0100af5:	0f 85 77 02 00 00    	jne    f0100d72 <check_page_free_list+0x288>
	if (!page_free_list)
f0100afb:	83 3d 40 72 21 f0 00 	cmpl   $0x0,0xf0217240
f0100b02:	74 0a                	je     f0100b0e <check_page_free_list+0x24>
	unsigned pdx_limit = only_low_memory ? 1 : NPDENTRIES;
f0100b04:	be 00 04 00 00       	mov    $0x400,%esi
f0100b09:	e9 bf 02 00 00       	jmp    f0100dcd <check_page_free_list+0x2e3>
		panic("'page_free_list' is a null pointer!");
f0100b0e:	83 ec 04             	sub    $0x4,%esp
f0100b11:	68 9c 6a 10 f0       	push   $0xf0106a9c
f0100b16:	68 ed 02 00 00       	push   $0x2ed
f0100b1b:	68 21 74 10 f0       	push   $0xf0107421
f0100b20:	e8 1b f5 ff ff       	call   f0100040 <_panic>
f0100b25:	50                   	push   %eax
f0100b26:	68 a4 65 10 f0       	push   $0xf01065a4
f0100b2b:	6a 58                	push   $0x58
f0100b2d:	68 2d 74 10 f0       	push   $0xf010742d
f0100b32:	e8 09 f5 ff ff       	call   f0100040 <_panic>
	for (pp = page_free_list; pp; pp = pp->pp_link)
f0100b37:	8b 1b                	mov    (%ebx),%ebx
f0100b39:	85 db                	test   %ebx,%ebx
f0100b3b:	74 41                	je     f0100b7e <check_page_free_list+0x94>
void	user_mem_assert(struct Env *env, const void *va, size_t len, int perm);

static inline physaddr_t
page2pa(struct PageInfo *pp)
{
	return (pp - pages) << PGSHIFT;
f0100b3d:	89 d8                	mov    %ebx,%eax
f0100b3f:	2b 05 90 7e 21 f0    	sub    0xf0217e90,%eax
f0100b45:	c1 f8 03             	sar    $0x3,%eax
f0100b48:	c1 e0 0c             	shl    $0xc,%eax
		if (PDX(page2pa(pp)) < pdx_limit)
f0100b4b:	89 c2                	mov    %eax,%edx
f0100b4d:	c1 ea 16             	shr    $0x16,%edx
f0100b50:	39 f2                	cmp    %esi,%edx
f0100b52:	73 e3                	jae    f0100b37 <check_page_free_list+0x4d>
	if (PGNUM(pa) >= npages)
f0100b54:	89 c2                	mov    %eax,%edx
f0100b56:	c1 ea 0c             	shr    $0xc,%edx
f0100b59:	3b 15 88 7e 21 f0    	cmp    0xf0217e88,%edx
f0100b5f:	73 c4                	jae    f0100b25 <check_page_free_list+0x3b>
			memset(page2kva(pp), 0x97, 128);
f0100b61:	83 ec 04             	sub    $0x4,%esp
f0100b64:	68 80 00 00 00       	push   $0x80
f0100b69:	68 97 00 00 00       	push   $0x97
	return (void *)(pa + KERNBASE);
f0100b6e:	2d 00 00 00 10       	sub    $0x10000000,%eax
f0100b73:	50                   	push   %eax
f0100b74:	e8 71 4d 00 00       	call   f01058ea <memset>
f0100b79:	83 c4 10             	add    $0x10,%esp
f0100b7c:	eb b9                	jmp    f0100b37 <check_page_free_list+0x4d>
	first_free_page = (char *) boot_alloc(0);
f0100b7e:	b8 00 00 00 00       	mov    $0x0,%eax
f0100b83:	e8 a0 fe ff ff       	call   f0100a28 <boot_alloc>
f0100b88:	89 45 cc             	mov    %eax,-0x34(%ebp)
	for (pp = page_free_list; pp; pp = pp->pp_link) {
f0100b8b:	8b 15 40 72 21 f0    	mov    0xf0217240,%edx
		assert(pp >= pages);
f0100b91:	8b 0d 90 7e 21 f0    	mov    0xf0217e90,%ecx
		assert(pp < pages + npages);
f0100b97:	a1 88 7e 21 f0       	mov    0xf0217e88,%eax
f0100b9c:	89 45 d0             	mov    %eax,-0x30(%ebp)
f0100b9f:	8d 34 c1             	lea    (%ecx,%eax,8),%esi
	int nfree_basemem = 0, nfree_extmem = 0;
f0100ba2:	bf 00 00 00 00       	mov    $0x0,%edi
f0100ba7:	89 5d d4             	mov    %ebx,-0x2c(%ebp)
	for (pp = page_free_list; pp; pp = pp->pp_link) {
f0100baa:	e9 f9 00 00 00       	jmp    f0100ca8 <check_page_free_list+0x1be>
		assert(pp >= pages);
f0100baf:	68 3b 74 10 f0       	push   $0xf010743b
f0100bb4:	68 47 74 10 f0       	push   $0xf0107447
f0100bb9:	68 07 03 00 00       	push   $0x307
f0100bbe:	68 21 74 10 f0       	push   $0xf0107421
f0100bc3:	e8 78 f4 ff ff       	call   f0100040 <_panic>
		assert(pp < pages + npages);
f0100bc8:	68 5c 74 10 f0       	push   $0xf010745c
f0100bcd:	68 47 74 10 f0       	push   $0xf0107447
f0100bd2:	68 08 03 00 00       	push   $0x308
f0100bd7:	68 21 74 10 f0       	push   $0xf0107421
f0100bdc:	e8 5f f4 ff ff       	call   f0100040 <_panic>
		assert(((char *) pp - (char *) pages) % sizeof(*pp) == 0);
f0100be1:	68 c0 6a 10 f0       	push   $0xf0106ac0
f0100be6:	68 47 74 10 f0       	push   $0xf0107447
f0100beb:	68 09 03 00 00       	push   $0x309
f0100bf0:	68 21 74 10 f0       	push   $0xf0107421
f0100bf5:	e8 46 f4 ff ff       	call   f0100040 <_panic>
		assert(page2pa(pp) != 0);
f0100bfa:	68 70 74 10 f0       	push   $0xf0107470
f0100bff:	68 47 74 10 f0       	push   $0xf0107447
f0100c04:	68 0c 03 00 00       	push   $0x30c
f0100c09:	68 21 74 10 f0       	push   $0xf0107421
f0100c0e:	e8 2d f4 ff ff       	call   f0100040 <_panic>
		assert(page2pa(pp) != IOPHYSMEM);
f0100c13:	68 81 74 10 f0       	push   $0xf0107481
f0100c18:	68 47 74 10 f0       	push   $0xf0107447
f0100c1d:	68 0d 03 00 00       	push   $0x30d
f0100c22:	68 21 74 10 f0       	push   $0xf0107421
f0100c27:	e8 14 f4 ff ff       	call   f0100040 <_panic>
		assert(page2pa(pp) != EXTPHYSMEM - PGSIZE);
f0100c2c:	68 f4 6a 10 f0       	push   $0xf0106af4
f0100c31:	68 47 74 10 f0       	push   $0xf0107447
f0100c36:	68 0e 03 00 00       	push   $0x30e
f0100c3b:	68 21 74 10 f0       	push   $0xf0107421
f0100c40:	e8 fb f3 ff ff       	call   f0100040 <_panic>
		assert(page2pa(pp) != EXTPHYSMEM);
f0100c45:	68 9a 74 10 f0       	push   $0xf010749a
f0100c4a:	68 47 74 10 f0       	push   $0xf0107447
f0100c4f:	68 0f 03 00 00       	push   $0x30f
f0100c54:	68 21 74 10 f0       	push   $0xf0107421
f0100c59:	e8 e2 f3 ff ff       	call   f0100040 <_panic>
	if (PGNUM(pa) >= npages)
f0100c5e:	89 c3                	mov    %eax,%ebx
f0100c60:	c1 eb 0c             	shr    $0xc,%ebx
f0100c63:	39 5d d0             	cmp    %ebx,-0x30(%ebp)
f0100c66:	76 0f                	jbe    f0100c77 <check_page_free_list+0x18d>
	return (void *)(pa + KERNBASE);
f0100c68:	2d 00 00 00 10       	sub    $0x10000000,%eax
		assert(page2pa(pp) < EXTPHYSMEM || (char *) page2kva(pp) >= first_free_page);
f0100c6d:	39 45 cc             	cmp    %eax,-0x34(%ebp)
f0100c70:	77 17                	ja     f0100c89 <check_page_free_list+0x19f>
			++nfree_extmem;
f0100c72:	83 c7 01             	add    $0x1,%edi
f0100c75:	eb 2f                	jmp    f0100ca6 <check_page_free_list+0x1bc>
		_panic(file, line, "KADDR called with invalid pa %08lx", pa);
f0100c77:	50                   	push   %eax
f0100c78:	68 a4 65 10 f0       	push   $0xf01065a4
f0100c7d:	6a 58                	push   $0x58
f0100c7f:	68 2d 74 10 f0       	push   $0xf010742d
f0100c84:	e8 b7 f3 ff ff       	call   f0100040 <_panic>
		assert(page2pa(pp) < EXTPHYSMEM || (char *) page2kva(pp) >= first_free_page);
f0100c89:	68 18 6b 10 f0       	push   $0xf0106b18
f0100c8e:	68 47 74 10 f0       	push   $0xf0107447
f0100c93:	68 10 03 00 00       	push   $0x310
f0100c98:	68 21 74 10 f0       	push   $0xf0107421
f0100c9d:	e8 9e f3 ff ff       	call   f0100040 <_panic>
			++nfree_basemem;
f0100ca2:	83 45 d4 01          	addl   $0x1,-0x2c(%ebp)
	for (pp = page_free_list; pp; pp = pp->pp_link) {
f0100ca6:	8b 12                	mov    (%edx),%edx
f0100ca8:	85 d2                	test   %edx,%edx
f0100caa:	74 74                	je     f0100d20 <check_page_free_list+0x236>
		assert(pp >= pages);
f0100cac:	39 d1                	cmp    %edx,%ecx
f0100cae:	0f 87 fb fe ff ff    	ja     f0100baf <check_page_free_list+0xc5>
		assert(pp < pages + npages);
f0100cb4:	39 d6                	cmp    %edx,%esi
f0100cb6:	0f 86 0c ff ff ff    	jbe    f0100bc8 <check_page_free_list+0xde>
		assert(((char *) pp - (char *) pages) % sizeof(*pp) == 0);
f0100cbc:	89 d0                	mov    %edx,%eax
f0100cbe:	29 c8                	sub    %ecx,%eax
f0100cc0:	a8 07                	test   $0x7,%al
f0100cc2:	0f 85 19 ff ff ff    	jne    f0100be1 <check_page_free_list+0xf7>
	return (pp - pages) << PGSHIFT;
f0100cc8:	c1 f8 03             	sar    $0x3,%eax
		assert(page2pa(pp) != 0);
f0100ccb:	c1 e0 0c             	shl    $0xc,%eax
f0100cce:	0f 84 26 ff ff ff    	je     f0100bfa <check_page_free_list+0x110>
		assert(page2pa(pp) != IOPHYSMEM);
f0100cd4:	3d 00 00 0a 00       	cmp    $0xa0000,%eax
f0100cd9:	0f 84 34 ff ff ff    	je     f0100c13 <check_page_free_list+0x129>
		assert(page2pa(pp) != EXTPHYSMEM - PGSIZE);
f0100cdf:	3d 00 f0 0f 00       	cmp    $0xff000,%eax
f0100ce4:	0f 84 42 ff ff ff    	je     f0100c2c <check_page_free_list+0x142>
		assert(page2pa(pp) != EXTPHYSMEM);
f0100cea:	3d 00 00 10 00       	cmp    $0x100000,%eax
f0100cef:	0f 84 50 ff ff ff    	je     f0100c45 <check_page_free_list+0x15b>
		assert(page2pa(pp) < EXTPHYSMEM || (char *) page2kva(pp) >= first_free_page);
f0100cf5:	3d ff ff 0f 00       	cmp    $0xfffff,%eax
f0100cfa:	0f 87 5e ff ff ff    	ja     f0100c5e <check_page_free_list+0x174>
		assert(page2pa(pp) != MPENTRY_PADDR);
f0100d00:	3d 00 70 00 00       	cmp    $0x7000,%eax
f0100d05:	75 9b                	jne    f0100ca2 <check_page_free_list+0x1b8>
f0100d07:	68 b4 74 10 f0       	push   $0xf01074b4
f0100d0c:	68 47 74 10 f0       	push   $0xf0107447
f0100d11:	68 12 03 00 00       	push   $0x312
f0100d16:	68 21 74 10 f0       	push   $0xf0107421
f0100d1b:	e8 20 f3 ff ff       	call   f0100040 <_panic>
f0100d20:	8b 5d d4             	mov    -0x2c(%ebp),%ebx
	assert(nfree_basemem > 0);
f0100d23:	85 db                	test   %ebx,%ebx
f0100d25:	7e 19                	jle    f0100d40 <check_page_free_list+0x256>
	assert(nfree_extmem > 0);
f0100d27:	85 ff                	test   %edi,%edi
f0100d29:	7e 2e                	jle    f0100d59 <check_page_free_list+0x26f>
	cprintf("check_page_free_list() succeeded!\n");
f0100d2b:	83 ec 0c             	sub    $0xc,%esp
f0100d2e:	68 60 6b 10 f0       	push   $0xf0106b60
f0100d33:	e8 a5 2a 00 00       	call   f01037dd <cprintf>
}
f0100d38:	8d 65 f4             	lea    -0xc(%ebp),%esp
f0100d3b:	5b                   	pop    %ebx
f0100d3c:	5e                   	pop    %esi
f0100d3d:	5f                   	pop    %edi
f0100d3e:	5d                   	pop    %ebp
f0100d3f:	c3                   	ret    
	assert(nfree_basemem > 0);
f0100d40:	68 d1 74 10 f0       	push   $0xf01074d1
f0100d45:	68 47 74 10 f0       	push   $0xf0107447
f0100d4a:	68 1a 03 00 00       	push   $0x31a
f0100d4f:	68 21 74 10 f0       	push   $0xf0107421
f0100d54:	e8 e7 f2 ff ff       	call   f0100040 <_panic>
	assert(nfree_extmem > 0);
f0100d59:	68 e3 74 10 f0       	push   $0xf01074e3
f0100d5e:	68 47 74 10 f0       	push   $0xf0107447
f0100d63:	68 1b 03 00 00       	push   $0x31b
f0100d68:	68 21 74 10 f0       	push   $0xf0107421
f0100d6d:	e8 ce f2 ff ff       	call   f0100040 <_panic>
	if (!page_free_list)
f0100d72:	a1 40 72 21 f0       	mov    0xf0217240,%eax
f0100d77:	85 c0                	test   %eax,%eax
f0100d79:	0f 84 8f fd ff ff    	je     f0100b0e <check_page_free_list+0x24>
		struct PageInfo **tp[2] = { &pp1, &pp2 };
f0100d7f:	8d 55 d8             	lea    -0x28(%ebp),%edx
f0100d82:	89 55 e0             	mov    %edx,-0x20(%ebp)
f0100d85:	8d 55 dc             	lea    -0x24(%ebp),%edx
f0100d88:	89 55 e4             	mov    %edx,-0x1c(%ebp)
f0100d8b:	89 c2                	mov    %eax,%edx
f0100d8d:	2b 15 90 7e 21 f0    	sub    0xf0217e90,%edx
			int pagetype = PDX(page2pa(pp)) >= pdx_limit;
f0100d93:	f7 c2 00 e0 7f 00    	test   $0x7fe000,%edx
f0100d99:	0f 95 c2             	setne  %dl
f0100d9c:	0f b6 d2             	movzbl %dl,%edx
			*tp[pagetype] = pp;
f0100d9f:	8b 4c 95 e0          	mov    -0x20(%ebp,%edx,4),%ecx
f0100da3:	89 01                	mov    %eax,(%ecx)
			tp[pagetype] = &pp->pp_link;
f0100da5:	89 44 95 e0          	mov    %eax,-0x20(%ebp,%edx,4)
		for (pp = page_free_list; pp; pp = pp->pp_link) {
f0100da9:	8b 00                	mov    (%eax),%eax
f0100dab:	85 c0                	test   %eax,%eax
f0100dad:	75 dc                	jne    f0100d8b <check_page_free_list+0x2a1>
		*tp[1] = 0;
f0100daf:	8b 45 e4             	mov    -0x1c(%ebp),%eax
f0100db2:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
		*tp[0] = pp2;
f0100db8:	8b 55 dc             	mov    -0x24(%ebp),%edx
f0100dbb:	8b 45 e0             	mov    -0x20(%ebp),%eax
f0100dbe:	89 10                	mov    %edx,(%eax)
		page_free_list = pp1;
f0100dc0:	8b 45 d8             	mov    -0x28(%ebp),%eax
f0100dc3:	a3 40 72 21 f0       	mov    %eax,0xf0217240
	unsigned pdx_limit = only_low_memory ? 1 : NPDENTRIES;
f0100dc8:	be 01 00 00 00       	mov    $0x1,%esi
	for (pp = page_free_list; pp; pp = pp->pp_link)
f0100dcd:	8b 1d 40 72 21 f0    	mov    0xf0217240,%ebx
f0100dd3:	e9 61 fd ff ff       	jmp    f0100b39 <check_page_free_list+0x4f>

f0100dd8 <page_init>:
{
f0100dd8:	f3 0f 1e fb          	endbr32 
f0100ddc:	55                   	push   %ebp
f0100ddd:	89 e5                	mov    %esp,%ebp
f0100ddf:	57                   	push   %edi
f0100de0:	56                   	push   %esi
f0100de1:	53                   	push   %ebx
f0100de2:	83 ec 1c             	sub    $0x1c,%esp
	size_t i, extendedFree = PGNUM(PADDR(boot_alloc(0)));
f0100de5:	b8 00 00 00 00       	mov    $0x0,%eax
f0100dea:	e8 39 fc ff ff       	call   f0100a28 <boot_alloc>
	if ((uint32_t)kva < KERNBASE)
f0100def:	3d ff ff ff ef       	cmp    $0xefffffff,%eax
f0100df4:	76 20                	jbe    f0100e16 <page_init+0x3e>
	return (physaddr_t)kva - KERNBASE;
f0100df6:	8d 98 00 00 00 10    	lea    0x10000000(%eax),%ebx
f0100dfc:	c1 eb 0c             	shr    $0xc,%ebx
		if(i == 0 || (i >= npages_basemem && i < extendedFree) || i == PGNUM(MPENTRY_PADDR)){	//change here
f0100dff:	8b 3d 44 72 21 f0    	mov    0xf0217244,%edi
f0100e05:	8b 35 40 72 21 f0    	mov    0xf0217240,%esi
	for(i = 0; i < npages; ++i){
f0100e0b:	c6 45 e7 00          	movb   $0x0,-0x19(%ebp)
f0100e0f:	b8 00 00 00 00       	mov    $0x0,%eax
f0100e14:	eb 2b                	jmp    f0100e41 <page_init+0x69>
		_panic(file, line, "PADDR called with invalid kva %08lx", kva);
f0100e16:	50                   	push   %eax
f0100e17:	68 c8 65 10 f0       	push   $0xf01065c8
f0100e1c:	68 45 01 00 00       	push   $0x145
f0100e21:	68 21 74 10 f0       	push   $0xf0107421
f0100e26:	e8 15 f2 ff ff       	call   f0100040 <_panic>
			pages[i].pp_link = NULL;
f0100e2b:	c7 01 00 00 00 00    	movl   $0x0,(%ecx)
			pages[i].pp_ref=1;
f0100e31:	8b 0d 90 7e 21 f0    	mov    0xf0217e90,%ecx
f0100e37:	66 c7 44 11 04 01 00 	movw   $0x1,0x4(%ecx,%edx,1)
	for(i = 0; i < npages; ++i){
f0100e3e:	83 c0 01             	add    $0x1,%eax
f0100e41:	39 05 88 7e 21 f0    	cmp    %eax,0xf0217e88
f0100e47:	76 36                	jbe    f0100e7f <page_init+0xa7>
f0100e49:	8d 14 c5 00 00 00 00 	lea    0x0(,%eax,8),%edx
		pages[i].pp_ref = 0;
f0100e50:	89 d1                	mov    %edx,%ecx
f0100e52:	03 0d 90 7e 21 f0    	add    0xf0217e90,%ecx
f0100e58:	66 c7 41 04 00 00    	movw   $0x0,0x4(%ecx)
		if(i == 0 || (i >= npages_basemem && i < extendedFree) || i == PGNUM(MPENTRY_PADDR)){	//change here
f0100e5e:	85 c0                	test   %eax,%eax
f0100e60:	74 c9                	je     f0100e2b <page_init+0x53>
f0100e62:	39 d8                	cmp    %ebx,%eax
f0100e64:	73 04                	jae    f0100e6a <page_init+0x92>
f0100e66:	39 c7                	cmp    %eax,%edi
f0100e68:	76 c1                	jbe    f0100e2b <page_init+0x53>
f0100e6a:	83 f8 07             	cmp    $0x7,%eax
f0100e6d:	74 bc                	je     f0100e2b <page_init+0x53>
			pages[i].pp_link = page_free_list;
f0100e6f:	89 31                	mov    %esi,(%ecx)
			page_free_list = &pages[i];
f0100e71:	89 d6                	mov    %edx,%esi
f0100e73:	03 35 90 7e 21 f0    	add    0xf0217e90,%esi
f0100e79:	c6 45 e7 01          	movb   $0x1,-0x19(%ebp)
f0100e7d:	eb bf                	jmp    f0100e3e <page_init+0x66>
f0100e7f:	80 7d e7 00          	cmpb   $0x0,-0x19(%ebp)
f0100e83:	74 06                	je     f0100e8b <page_init+0xb3>
f0100e85:	89 35 40 72 21 f0    	mov    %esi,0xf0217240
}
f0100e8b:	8d 65 f4             	lea    -0xc(%ebp),%esp
f0100e8e:	5b                   	pop    %ebx
f0100e8f:	5e                   	pop    %esi
f0100e90:	5f                   	pop    %edi
f0100e91:	5d                   	pop    %ebp
f0100e92:	c3                   	ret    

f0100e93 <page_alloc>:
{
f0100e93:	f3 0f 1e fb          	endbr32 
f0100e97:	55                   	push   %ebp
f0100e98:	89 e5                	mov    %esp,%ebp
f0100e9a:	53                   	push   %ebx
f0100e9b:	83 ec 04             	sub    $0x4,%esp
	if(page_free_list==NULL){
f0100e9e:	8b 1d 40 72 21 f0    	mov    0xf0217240,%ebx
f0100ea4:	85 db                	test   %ebx,%ebx
f0100ea6:	74 13                	je     f0100ebb <page_alloc+0x28>
	page_free_list=page_free_list->pp_link;
f0100ea8:	8b 03                	mov    (%ebx),%eax
f0100eaa:	a3 40 72 21 f0       	mov    %eax,0xf0217240
	pp->pp_link=NULL;
f0100eaf:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
	if(alloc_flags&ALLOC_ZERO){
f0100eb5:	f6 45 08 01          	testb  $0x1,0x8(%ebp)
f0100eb9:	75 07                	jne    f0100ec2 <page_alloc+0x2f>
}
f0100ebb:	89 d8                	mov    %ebx,%eax
f0100ebd:	8b 5d fc             	mov    -0x4(%ebp),%ebx
f0100ec0:	c9                   	leave  
f0100ec1:	c3                   	ret    
	return (pp - pages) << PGSHIFT;
f0100ec2:	89 d8                	mov    %ebx,%eax
f0100ec4:	2b 05 90 7e 21 f0    	sub    0xf0217e90,%eax
f0100eca:	c1 f8 03             	sar    $0x3,%eax
f0100ecd:	89 c2                	mov    %eax,%edx
f0100ecf:	c1 e2 0c             	shl    $0xc,%edx
	if (PGNUM(pa) >= npages)
f0100ed2:	25 ff ff 0f 00       	and    $0xfffff,%eax
f0100ed7:	3b 05 88 7e 21 f0    	cmp    0xf0217e88,%eax
f0100edd:	73 1b                	jae    f0100efa <page_alloc+0x67>
		 memset(va,'\0', PGSIZE);
f0100edf:	83 ec 04             	sub    $0x4,%esp
f0100ee2:	68 00 10 00 00       	push   $0x1000
f0100ee7:	6a 00                	push   $0x0
	return (void *)(pa + KERNBASE);
f0100ee9:	81 ea 00 00 00 10    	sub    $0x10000000,%edx
f0100eef:	52                   	push   %edx
f0100ef0:	e8 f5 49 00 00       	call   f01058ea <memset>
f0100ef5:	83 c4 10             	add    $0x10,%esp
f0100ef8:	eb c1                	jmp    f0100ebb <page_alloc+0x28>
		_panic(file, line, "KADDR called with invalid pa %08lx", pa);
f0100efa:	52                   	push   %edx
f0100efb:	68 a4 65 10 f0       	push   $0xf01065a4
f0100f00:	6a 58                	push   $0x58
f0100f02:	68 2d 74 10 f0       	push   $0xf010742d
f0100f07:	e8 34 f1 ff ff       	call   f0100040 <_panic>

f0100f0c <page_free>:
{
f0100f0c:	f3 0f 1e fb          	endbr32 
f0100f10:	55                   	push   %ebp
f0100f11:	89 e5                	mov    %esp,%ebp
f0100f13:	83 ec 08             	sub    $0x8,%esp
f0100f16:	8b 45 08             	mov    0x8(%ebp),%eax
	if(pp->pp_link || pp->pp_ref) {
f0100f19:	83 38 00             	cmpl   $0x0,(%eax)
f0100f1c:	75 16                	jne    f0100f34 <page_free+0x28>
f0100f1e:	66 83 78 04 00       	cmpw   $0x0,0x4(%eax)
f0100f23:	75 0f                	jne    f0100f34 <page_free+0x28>
    pp->pp_link = page_free_list;
f0100f25:	8b 15 40 72 21 f0    	mov    0xf0217240,%edx
f0100f2b:	89 10                	mov    %edx,(%eax)
    page_free_list = pp;
f0100f2d:	a3 40 72 21 f0       	mov    %eax,0xf0217240
}
f0100f32:	c9                   	leave  
f0100f33:	c3                   	ret    
        panic("pp->pp_ref is nonzero or pp->pp_link is not NULL\n");
f0100f34:	83 ec 04             	sub    $0x4,%esp
f0100f37:	68 84 6b 10 f0       	push   $0xf0106b84
f0100f3c:	68 83 01 00 00       	push   $0x183
f0100f41:	68 21 74 10 f0       	push   $0xf0107421
f0100f46:	e8 f5 f0 ff ff       	call   f0100040 <_panic>

f0100f4b <page_decref>:
{
f0100f4b:	f3 0f 1e fb          	endbr32 
f0100f4f:	55                   	push   %ebp
f0100f50:	89 e5                	mov    %esp,%ebp
f0100f52:	83 ec 08             	sub    $0x8,%esp
f0100f55:	8b 55 08             	mov    0x8(%ebp),%edx
	if (--pp->pp_ref == 0)
f0100f58:	0f b7 42 04          	movzwl 0x4(%edx),%eax
f0100f5c:	83 e8 01             	sub    $0x1,%eax
f0100f5f:	66 89 42 04          	mov    %ax,0x4(%edx)
f0100f63:	66 85 c0             	test   %ax,%ax
f0100f66:	74 02                	je     f0100f6a <page_decref+0x1f>
}
f0100f68:	c9                   	leave  
f0100f69:	c3                   	ret    
		page_free(pp);
f0100f6a:	83 ec 0c             	sub    $0xc,%esp
f0100f6d:	52                   	push   %edx
f0100f6e:	e8 99 ff ff ff       	call   f0100f0c <page_free>
f0100f73:	83 c4 10             	add    $0x10,%esp
}
f0100f76:	eb f0                	jmp    f0100f68 <page_decref+0x1d>

f0100f78 <pgdir_walk>:
{
f0100f78:	f3 0f 1e fb          	endbr32 
f0100f7c:	55                   	push   %ebp
f0100f7d:	89 e5                	mov    %esp,%ebp
f0100f7f:	56                   	push   %esi
f0100f80:	53                   	push   %ebx
f0100f81:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	pte_t pte_index = PTX(va);
f0100f84:	89 de                	mov    %ebx,%esi
f0100f86:	c1 ee 0c             	shr    $0xc,%esi
f0100f89:	81 e6 ff 03 00 00    	and    $0x3ff,%esi
	pde_t pde_index = PDX(va);
f0100f8f:	c1 eb 16             	shr    $0x16,%ebx
	pde_t*pde=pgdir+pde_index;
f0100f92:	c1 e3 02             	shl    $0x2,%ebx
f0100f95:	03 5d 08             	add    0x8(%ebp),%ebx
    if(((*pde)&PTE_P)==0){
f0100f98:	f6 03 01             	testb  $0x1,(%ebx)
f0100f9b:	75 2f                	jne    f0100fcc <pgdir_walk+0x54>
		if(create==0)
f0100f9d:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
f0100fa1:	74 61                	je     f0101004 <pgdir_walk+0x8c>
		new_PT=page_alloc(1);//ps:1代表取一页并且把该页全部初始化为0
f0100fa3:	83 ec 0c             	sub    $0xc,%esp
f0100fa6:	6a 01                	push   $0x1
f0100fa8:	e8 e6 fe ff ff       	call   f0100e93 <page_alloc>
		if(new_PT==NULL)
f0100fad:	83 c4 10             	add    $0x10,%esp
f0100fb0:	85 c0                	test   %eax,%eax
f0100fb2:	74 34                	je     f0100fe8 <pgdir_walk+0x70>
		new_PT->pp_ref++;
f0100fb4:	66 83 40 04 01       	addw   $0x1,0x4(%eax)
	return (pp - pages) << PGSHIFT;
f0100fb9:	2b 05 90 7e 21 f0    	sub    0xf0217e90,%eax
f0100fbf:	c1 f8 03             	sar    $0x3,%eax
f0100fc2:	c1 e0 0c             	shl    $0xc,%eax
		*pde = page2pa(new_PT) | PTE_P | PTE_U |PTE_W | PTE_AVAIL;
f0100fc5:	0d 07 0e 00 00       	or     $0xe07,%eax
f0100fca:	89 03                	mov    %eax,(%ebx)
	pte = (pte_t *)KADDR(PTE_ADDR(*pde));
f0100fcc:	8b 03                	mov    (%ebx),%eax
f0100fce:	89 c2                	mov    %eax,%edx
f0100fd0:	81 e2 00 f0 ff ff    	and    $0xfffff000,%edx
	if (PGNUM(pa) >= npages)
f0100fd6:	c1 e8 0c             	shr    $0xc,%eax
f0100fd9:	3b 05 88 7e 21 f0    	cmp    0xf0217e88,%eax
f0100fdf:	73 0e                	jae    f0100fef <pgdir_walk+0x77>
    return &pte[pte_index];
f0100fe1:	8d 84 b2 00 00 00 f0 	lea    -0x10000000(%edx,%esi,4),%eax
}
f0100fe8:	8d 65 f8             	lea    -0x8(%ebp),%esp
f0100feb:	5b                   	pop    %ebx
f0100fec:	5e                   	pop    %esi
f0100fed:	5d                   	pop    %ebp
f0100fee:	c3                   	ret    
		_panic(file, line, "KADDR called with invalid pa %08lx", pa);
f0100fef:	52                   	push   %edx
f0100ff0:	68 a4 65 10 f0       	push   $0xf01065a4
f0100ff5:	68 cb 01 00 00       	push   $0x1cb
f0100ffa:	68 21 74 10 f0       	push   $0xf0107421
f0100fff:	e8 3c f0 ff ff       	call   f0100040 <_panic>
		return NULL;
f0101004:	b8 00 00 00 00       	mov    $0x0,%eax
f0101009:	eb dd                	jmp    f0100fe8 <pgdir_walk+0x70>

f010100b <boot_map_region>:
{
f010100b:	55                   	push   %ebp
f010100c:	89 e5                	mov    %esp,%ebp
f010100e:	57                   	push   %edi
f010100f:	56                   	push   %esi
f0101010:	53                   	push   %ebx
f0101011:	83 ec 1c             	sub    $0x1c,%esp
f0101014:	89 c7                	mov    %eax,%edi
f0101016:	89 55 e0             	mov    %edx,-0x20(%ebp)
f0101019:	89 4d e4             	mov    %ecx,-0x1c(%ebp)
	for(size_t i=0;i*PGSIZE<size;++i){
f010101c:	be 00 00 00 00       	mov    $0x0,%esi
f0101021:	89 f3                	mov    %esi,%ebx
f0101023:	03 5d 08             	add    0x8(%ebp),%ebx
f0101026:	39 75 e4             	cmp    %esi,-0x1c(%ebp)
f0101029:	76 41                	jbe    f010106c <boot_map_region+0x61>
	pte_t *pte = pgdir_walk(pgdir, (void *)va, 1);
f010102b:	83 ec 04             	sub    $0x4,%esp
f010102e:	6a 01                	push   $0x1
f0101030:	8b 45 e0             	mov    -0x20(%ebp),%eax
f0101033:	01 f0                	add    %esi,%eax
f0101035:	50                   	push   %eax
f0101036:	57                   	push   %edi
f0101037:	e8 3c ff ff ff       	call   f0100f78 <pgdir_walk>
f010103c:	81 c6 00 10 00 00    	add    $0x1000,%esi
   	assert(pte);
f0101042:	83 c4 10             	add    $0x10,%esp
f0101045:	85 c0                	test   %eax,%eax
f0101047:	74 0a                	je     f0101053 <boot_map_region+0x48>
   	*pte = pa| perm | PTE_P;
f0101049:	0b 5d 0c             	or     0xc(%ebp),%ebx
f010104c:	83 cb 01             	or     $0x1,%ebx
f010104f:	89 18                	mov    %ebx,(%eax)
f0101051:	eb ce                	jmp    f0101021 <boot_map_region+0x16>
   	assert(pte);
f0101053:	68 f4 74 10 f0       	push   $0xf01074f4
f0101058:	68 47 74 10 f0       	push   $0xf0107447
f010105d:	68 e2 01 00 00       	push   $0x1e2
f0101062:	68 21 74 10 f0       	push   $0xf0107421
f0101067:	e8 d4 ef ff ff       	call   f0100040 <_panic>
}
f010106c:	8d 65 f4             	lea    -0xc(%ebp),%esp
f010106f:	5b                   	pop    %ebx
f0101070:	5e                   	pop    %esi
f0101071:	5f                   	pop    %edi
f0101072:	5d                   	pop    %ebp
f0101073:	c3                   	ret    

f0101074 <page_lookup>:
{
f0101074:	f3 0f 1e fb          	endbr32 
f0101078:	55                   	push   %ebp
f0101079:	89 e5                	mov    %esp,%ebp
f010107b:	53                   	push   %ebx
f010107c:	83 ec 08             	sub    $0x8,%esp
f010107f:	8b 5d 10             	mov    0x10(%ebp),%ebx
	pte_t *pte = pgdir_walk(pgdir, va, 0);
f0101082:	6a 00                	push   $0x0
f0101084:	ff 75 0c             	pushl  0xc(%ebp)
f0101087:	ff 75 08             	pushl  0x8(%ebp)
f010108a:	e8 e9 fe ff ff       	call   f0100f78 <pgdir_walk>
    if (!pte) {
f010108f:	83 c4 10             	add    $0x10,%esp
f0101092:	85 c0                	test   %eax,%eax
f0101094:	74 12                	je     f01010a8 <page_lookup+0x34>
    if (pte_store) {
f0101096:	85 db                	test   %ebx,%ebx
f0101098:	74 02                	je     f010109c <page_lookup+0x28>
        *pte_store = pte;  // 通过指针的指针返回指针给调用者
f010109a:	89 03                	mov    %eax,(%ebx)
      if (*pte & PTE_P) {
f010109c:	8b 10                	mov    (%eax),%edx
    return NULL;
f010109e:	b8 00 00 00 00       	mov    $0x0,%eax
      if (*pte & PTE_P) {
f01010a3:	f6 c2 01             	test   $0x1,%dl
f01010a6:	75 05                	jne    f01010ad <page_lookup+0x39>
}
f01010a8:	8b 5d fc             	mov    -0x4(%ebp),%ebx
f01010ab:	c9                   	leave  
f01010ac:	c3                   	ret    
f01010ad:	c1 ea 0c             	shr    $0xc,%edx
}

static inline struct PageInfo*
pa2page(physaddr_t pa)
{
	if (PGNUM(pa) >= npages)
f01010b0:	39 15 88 7e 21 f0    	cmp    %edx,0xf0217e88
f01010b6:	76 0a                	jbe    f01010c2 <page_lookup+0x4e>
		panic("pa2page called with invalid pa");
	return &pages[PGNUM(pa)];
f01010b8:	a1 90 7e 21 f0       	mov    0xf0217e90,%eax
f01010bd:	8d 04 d0             	lea    (%eax,%edx,8),%eax
        return (pa2page(PTE_ADDR(*pte)));
f01010c0:	eb e6                	jmp    f01010a8 <page_lookup+0x34>
		panic("pa2page called with invalid pa");
f01010c2:	83 ec 04             	sub    $0x4,%esp
f01010c5:	68 b8 6b 10 f0       	push   $0xf0106bb8
f01010ca:	6a 51                	push   $0x51
f01010cc:	68 2d 74 10 f0       	push   $0xf010742d
f01010d1:	e8 6a ef ff ff       	call   f0100040 <_panic>

f01010d6 <tlb_invalidate>:
{
f01010d6:	f3 0f 1e fb          	endbr32 
f01010da:	55                   	push   %ebp
f01010db:	89 e5                	mov    %esp,%ebp
f01010dd:	83 ec 08             	sub    $0x8,%esp
	if (!curenv || curenv->env_pgdir == pgdir)
f01010e0:	e8 25 4e 00 00       	call   f0105f0a <cpunum>
f01010e5:	6b c0 74             	imul   $0x74,%eax,%eax
f01010e8:	83 b8 28 80 21 f0 00 	cmpl   $0x0,-0xfde7fd8(%eax)
f01010ef:	74 16                	je     f0101107 <tlb_invalidate+0x31>
f01010f1:	e8 14 4e 00 00       	call   f0105f0a <cpunum>
f01010f6:	6b c0 74             	imul   $0x74,%eax,%eax
f01010f9:	8b 80 28 80 21 f0    	mov    -0xfde7fd8(%eax),%eax
f01010ff:	8b 55 08             	mov    0x8(%ebp),%edx
f0101102:	39 50 60             	cmp    %edx,0x60(%eax)
f0101105:	75 06                	jne    f010110d <tlb_invalidate+0x37>
	asm volatile("invlpg (%0)" : : "r" (addr) : "memory");
f0101107:	8b 45 0c             	mov    0xc(%ebp),%eax
f010110a:	0f 01 38             	invlpg (%eax)
}
f010110d:	c9                   	leave  
f010110e:	c3                   	ret    

f010110f <page_remove>:
{
f010110f:	f3 0f 1e fb          	endbr32 
f0101113:	55                   	push   %ebp
f0101114:	89 e5                	mov    %esp,%ebp
f0101116:	56                   	push   %esi
f0101117:	53                   	push   %ebx
f0101118:	83 ec 14             	sub    $0x14,%esp
f010111b:	8b 5d 08             	mov    0x8(%ebp),%ebx
f010111e:	8b 75 0c             	mov    0xc(%ebp),%esi
    struct PageInfo *pi = page_lookup(pgdir, va, pte_store);
f0101121:	8d 45 f4             	lea    -0xc(%ebp),%eax
f0101124:	50                   	push   %eax
f0101125:	56                   	push   %esi
f0101126:	53                   	push   %ebx
f0101127:	e8 48 ff ff ff       	call   f0101074 <page_lookup>
    if (!pi) {
f010112c:	83 c4 10             	add    $0x10,%esp
f010112f:	85 c0                	test   %eax,%eax
f0101131:	74 1f                	je     f0101152 <page_remove+0x43>
    page_decref(pi);     // 减引用
f0101133:	83 ec 0c             	sub    $0xc,%esp
f0101136:	50                   	push   %eax
f0101137:	e8 0f fe ff ff       	call   f0100f4b <page_decref>
    **pte_store = 0;     // 取消映射
f010113c:	8b 45 f4             	mov    -0xc(%ebp),%eax
f010113f:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
    tlb_invalidate(pgdir, va);
f0101145:	83 c4 08             	add    $0x8,%esp
f0101148:	56                   	push   %esi
f0101149:	53                   	push   %ebx
f010114a:	e8 87 ff ff ff       	call   f01010d6 <tlb_invalidate>
f010114f:	83 c4 10             	add    $0x10,%esp
}
f0101152:	8d 65 f8             	lea    -0x8(%ebp),%esp
f0101155:	5b                   	pop    %ebx
f0101156:	5e                   	pop    %esi
f0101157:	5d                   	pop    %ebp
f0101158:	c3                   	ret    

f0101159 <page_insert>:
{
f0101159:	f3 0f 1e fb          	endbr32 
f010115d:	55                   	push   %ebp
f010115e:	89 e5                	mov    %esp,%ebp
f0101160:	57                   	push   %edi
f0101161:	56                   	push   %esi
f0101162:	53                   	push   %ebx
f0101163:	83 ec 10             	sub    $0x10,%esp
f0101166:	8b 5d 0c             	mov    0xc(%ebp),%ebx
f0101169:	8b 7d 10             	mov    0x10(%ebp),%edi
	pte_t *pte=pgdir_walk(pgdir,va,1);
f010116c:	6a 01                	push   $0x1
f010116e:	57                   	push   %edi
f010116f:	ff 75 08             	pushl  0x8(%ebp)
f0101172:	e8 01 fe ff ff       	call   f0100f78 <pgdir_walk>
	if(pte==NULL){
f0101177:	83 c4 10             	add    $0x10,%esp
f010117a:	85 c0                	test   %eax,%eax
f010117c:	74 5b                	je     f01011d9 <page_insert+0x80>
f010117e:	89 c6                	mov    %eax,%esi
	if(*pte&PTE_P){
f0101180:	8b 00                	mov    (%eax),%eax
f0101182:	a8 01                	test   $0x1,%al
f0101184:	74 1c                	je     f01011a2 <page_insert+0x49>
		if(PTE_ADDR(*pte)==page2pa(pp)){
f0101186:	25 00 f0 ff ff       	and    $0xfffff000,%eax
	return (pp - pages) << PGSHIFT;
f010118b:	89 da                	mov    %ebx,%edx
f010118d:	2b 15 90 7e 21 f0    	sub    0xf0217e90,%edx
f0101193:	c1 fa 03             	sar    $0x3,%edx
f0101196:	c1 e2 0c             	shl    $0xc,%edx
f0101199:	39 d0                	cmp    %edx,%eax
f010119b:	75 2b                	jne    f01011c8 <page_insert+0x6f>
			pp->pp_ref--;
f010119d:	66 83 6b 04 01       	subw   $0x1,0x4(%ebx)
	pp->pp_ref++;
f01011a2:	66 83 43 04 01       	addw   $0x1,0x4(%ebx)
f01011a7:	2b 1d 90 7e 21 f0    	sub    0xf0217e90,%ebx
f01011ad:	c1 fb 03             	sar    $0x3,%ebx
f01011b0:	c1 e3 0c             	shl    $0xc,%ebx
    *pte = page2pa(pp)| perm | PTE_P;
f01011b3:	0b 5d 14             	or     0x14(%ebp),%ebx
f01011b6:	83 cb 01             	or     $0x1,%ebx
f01011b9:	89 1e                	mov    %ebx,(%esi)
    return 0;
f01011bb:	b8 00 00 00 00       	mov    $0x0,%eax
}
f01011c0:	8d 65 f4             	lea    -0xc(%ebp),%esp
f01011c3:	5b                   	pop    %ebx
f01011c4:	5e                   	pop    %esi
f01011c5:	5f                   	pop    %edi
f01011c6:	5d                   	pop    %ebp
f01011c7:	c3                   	ret    
			page_remove(pgdir, va);
f01011c8:	83 ec 08             	sub    $0x8,%esp
f01011cb:	57                   	push   %edi
f01011cc:	ff 75 08             	pushl  0x8(%ebp)
f01011cf:	e8 3b ff ff ff       	call   f010110f <page_remove>
f01011d4:	83 c4 10             	add    $0x10,%esp
f01011d7:	eb c9                	jmp    f01011a2 <page_insert+0x49>
		return  -E_NO_MEM;
f01011d9:	b8 fc ff ff ff       	mov    $0xfffffffc,%eax
f01011de:	eb e0                	jmp    f01011c0 <page_insert+0x67>

f01011e0 <mmio_map_region>:
{
f01011e0:	f3 0f 1e fb          	endbr32 
f01011e4:	55                   	push   %ebp
f01011e5:	89 e5                	mov    %esp,%ebp
f01011e7:	53                   	push   %ebx
f01011e8:	83 ec 04             	sub    $0x4,%esp
	size_t size_up=ROUNDUP(size,PGSIZE);
f01011eb:	8b 45 0c             	mov    0xc(%ebp),%eax
f01011ee:	8d 98 ff 0f 00 00    	lea    0xfff(%eax),%ebx
f01011f4:	81 e3 00 f0 ff ff    	and    $0xfffff000,%ebx
	if(base+size_up>MMIOLIM||base+size_up<base){
f01011fa:	8b 15 00 33 12 f0    	mov    0xf0123300,%edx
f0101200:	89 d0                	mov    %edx,%eax
f0101202:	01 d8                	add    %ebx,%eax
f0101204:	72 2d                	jb     f0101233 <mmio_map_region+0x53>
f0101206:	3d 00 00 c0 ef       	cmp    $0xefc00000,%eax
f010120b:	77 26                	ja     f0101233 <mmio_map_region+0x53>
	boot_map_region(kern_pgdir,base,size_up,pa,(PTE_PCD|PTE_PWT|PTE_W));
f010120d:	83 ec 08             	sub    $0x8,%esp
f0101210:	6a 1a                	push   $0x1a
f0101212:	ff 75 08             	pushl  0x8(%ebp)
f0101215:	89 d9                	mov    %ebx,%ecx
f0101217:	a1 8c 7e 21 f0       	mov    0xf0217e8c,%eax
f010121c:	e8 ea fd ff ff       	call   f010100b <boot_map_region>
	base+=size_up;
f0101221:	a1 00 33 12 f0       	mov    0xf0123300,%eax
f0101226:	01 c3                	add    %eax,%ebx
f0101228:	89 1d 00 33 12 f0    	mov    %ebx,0xf0123300
}
f010122e:	8b 5d fc             	mov    -0x4(%ebp),%ebx
f0101231:	c9                   	leave  
f0101232:	c3                   	ret    
		panic("The mmio_map_region function overflows MMIOLIM!");
f0101233:	83 ec 04             	sub    $0x4,%esp
f0101236:	68 d8 6b 10 f0       	push   $0xf0106bd8
f010123b:	68 97 02 00 00       	push   $0x297
f0101240:	68 21 74 10 f0       	push   $0xf0107421
f0101245:	e8 f6 ed ff ff       	call   f0100040 <_panic>

f010124a <mem_init>:
{
f010124a:	f3 0f 1e fb          	endbr32 
f010124e:	55                   	push   %ebp
f010124f:	89 e5                	mov    %esp,%ebp
f0101251:	57                   	push   %edi
f0101252:	56                   	push   %esi
f0101253:	53                   	push   %ebx
f0101254:	83 ec 3c             	sub    $0x3c,%esp
	basemem = nvram_read(NVRAM_BASELO);
f0101257:	b8 15 00 00 00       	mov    $0x15,%eax
f010125c:	e8 fd f7 ff ff       	call   f0100a5e <nvram_read>
f0101261:	89 c3                	mov    %eax,%ebx
	extmem = nvram_read(NVRAM_EXTLO);
f0101263:	b8 17 00 00 00       	mov    $0x17,%eax
f0101268:	e8 f1 f7 ff ff       	call   f0100a5e <nvram_read>
f010126d:	89 c6                	mov    %eax,%esi
	ext16mem = nvram_read(NVRAM_EXT16LO) * 64;
f010126f:	b8 34 00 00 00       	mov    $0x34,%eax
f0101274:	e8 e5 f7 ff ff       	call   f0100a5e <nvram_read>
	if (ext16mem)
f0101279:	c1 e0 06             	shl    $0x6,%eax
f010127c:	0f 84 ea 00 00 00    	je     f010136c <mem_init+0x122>
		totalmem = 16 * 1024 + ext16mem;
f0101282:	05 00 40 00 00       	add    $0x4000,%eax
	npages = totalmem / (PGSIZE / 1024);
f0101287:	89 c2                	mov    %eax,%edx
f0101289:	c1 ea 02             	shr    $0x2,%edx
f010128c:	89 15 88 7e 21 f0    	mov    %edx,0xf0217e88
	npages_basemem = basemem / (PGSIZE / 1024);
f0101292:	89 da                	mov    %ebx,%edx
f0101294:	c1 ea 02             	shr    $0x2,%edx
f0101297:	89 15 44 72 21 f0    	mov    %edx,0xf0217244
	cprintf("Physical memory: %uK available, base = %uK, extended = %uK\n",
f010129d:	89 c2                	mov    %eax,%edx
f010129f:	29 da                	sub    %ebx,%edx
f01012a1:	52                   	push   %edx
f01012a2:	53                   	push   %ebx
f01012a3:	50                   	push   %eax
f01012a4:	68 08 6c 10 f0       	push   $0xf0106c08
f01012a9:	e8 2f 25 00 00       	call   f01037dd <cprintf>
	kern_pgdir = (pde_t *) boot_alloc(PGSIZE);
f01012ae:	b8 00 10 00 00       	mov    $0x1000,%eax
f01012b3:	e8 70 f7 ff ff       	call   f0100a28 <boot_alloc>
f01012b8:	a3 8c 7e 21 f0       	mov    %eax,0xf0217e8c
	memset(kern_pgdir, 0, PGSIZE);
f01012bd:	83 c4 0c             	add    $0xc,%esp
f01012c0:	68 00 10 00 00       	push   $0x1000
f01012c5:	6a 00                	push   $0x0
f01012c7:	50                   	push   %eax
f01012c8:	e8 1d 46 00 00       	call   f01058ea <memset>
	kern_pgdir[PDX(UVPT)] = PADDR(kern_pgdir) | PTE_U | PTE_P;
f01012cd:	a1 8c 7e 21 f0       	mov    0xf0217e8c,%eax
	if ((uint32_t)kva < KERNBASE)
f01012d2:	83 c4 10             	add    $0x10,%esp
f01012d5:	3d ff ff ff ef       	cmp    $0xefffffff,%eax
f01012da:	0f 86 9c 00 00 00    	jbe    f010137c <mem_init+0x132>
	return (physaddr_t)kva - KERNBASE;
f01012e0:	8d 90 00 00 00 10    	lea    0x10000000(%eax),%edx
f01012e6:	83 ca 05             	or     $0x5,%edx
f01012e9:	89 90 f4 0e 00 00    	mov    %edx,0xef4(%eax)
	pages=(struct PageInfo *)boot_alloc(npages*sizeof(struct PageInfo));
f01012ef:	a1 88 7e 21 f0       	mov    0xf0217e88,%eax
f01012f4:	c1 e0 03             	shl    $0x3,%eax
f01012f7:	e8 2c f7 ff ff       	call   f0100a28 <boot_alloc>
f01012fc:	a3 90 7e 21 f0       	mov    %eax,0xf0217e90
	memset(pages,0,npages*sizeof(struct PageInfo));
f0101301:	83 ec 04             	sub    $0x4,%esp
f0101304:	8b 0d 88 7e 21 f0    	mov    0xf0217e88,%ecx
f010130a:	8d 14 cd 00 00 00 00 	lea    0x0(,%ecx,8),%edx
f0101311:	52                   	push   %edx
f0101312:	6a 00                	push   $0x0
f0101314:	50                   	push   %eax
f0101315:	e8 d0 45 00 00       	call   f01058ea <memset>
	envs=(struct Env *)boot_alloc(NENV*sizeof(struct Env));
f010131a:	b8 00 f0 01 00       	mov    $0x1f000,%eax
f010131f:	e8 04 f7 ff ff       	call   f0100a28 <boot_alloc>
f0101324:	a3 48 72 21 f0       	mov    %eax,0xf0217248
	memset(envs,0,NENV*sizeof(struct Env));
f0101329:	83 c4 0c             	add    $0xc,%esp
f010132c:	68 00 f0 01 00       	push   $0x1f000
f0101331:	6a 00                	push   $0x0
f0101333:	50                   	push   %eax
f0101334:	e8 b1 45 00 00       	call   f01058ea <memset>
	page_init();
f0101339:	e8 9a fa ff ff       	call   f0100dd8 <page_init>
	check_page_free_list(1);
f010133e:	b8 01 00 00 00       	mov    $0x1,%eax
f0101343:	e8 a2 f7 ff ff       	call   f0100aea <check_page_free_list>
	if (!pages)
f0101348:	83 c4 10             	add    $0x10,%esp
f010134b:	83 3d 90 7e 21 f0 00 	cmpl   $0x0,0xf0217e90
f0101352:	74 3d                	je     f0101391 <mem_init+0x147>
	for (pp = page_free_list, nfree = 0; pp; pp = pp->pp_link)
f0101354:	a1 40 72 21 f0       	mov    0xf0217240,%eax
f0101359:	c7 45 d4 00 00 00 00 	movl   $0x0,-0x2c(%ebp)
f0101360:	85 c0                	test   %eax,%eax
f0101362:	74 44                	je     f01013a8 <mem_init+0x15e>
		++nfree;
f0101364:	83 45 d4 01          	addl   $0x1,-0x2c(%ebp)
	for (pp = page_free_list, nfree = 0; pp; pp = pp->pp_link)
f0101368:	8b 00                	mov    (%eax),%eax
f010136a:	eb f4                	jmp    f0101360 <mem_init+0x116>
		totalmem = 1 * 1024 + extmem;
f010136c:	8d 86 00 04 00 00    	lea    0x400(%esi),%eax
f0101372:	85 f6                	test   %esi,%esi
f0101374:	0f 44 c3             	cmove  %ebx,%eax
f0101377:	e9 0b ff ff ff       	jmp    f0101287 <mem_init+0x3d>
		_panic(file, line, "PADDR called with invalid kva %08lx", kva);
f010137c:	50                   	push   %eax
f010137d:	68 c8 65 10 f0       	push   $0xf01065c8
f0101382:	68 9a 00 00 00       	push   $0x9a
f0101387:	68 21 74 10 f0       	push   $0xf0107421
f010138c:	e8 af ec ff ff       	call   f0100040 <_panic>
		panic("'pages' is a null pointer!");
f0101391:	83 ec 04             	sub    $0x4,%esp
f0101394:	68 f8 74 10 f0       	push   $0xf01074f8
f0101399:	68 2e 03 00 00       	push   $0x32e
f010139e:	68 21 74 10 f0       	push   $0xf0107421
f01013a3:	e8 98 ec ff ff       	call   f0100040 <_panic>
	assert((pp0 = page_alloc(0)));
f01013a8:	83 ec 0c             	sub    $0xc,%esp
f01013ab:	6a 00                	push   $0x0
f01013ad:	e8 e1 fa ff ff       	call   f0100e93 <page_alloc>
f01013b2:	89 c3                	mov    %eax,%ebx
f01013b4:	83 c4 10             	add    $0x10,%esp
f01013b7:	85 c0                	test   %eax,%eax
f01013b9:	0f 84 11 02 00 00    	je     f01015d0 <mem_init+0x386>
	assert((pp1 = page_alloc(0)));
f01013bf:	83 ec 0c             	sub    $0xc,%esp
f01013c2:	6a 00                	push   $0x0
f01013c4:	e8 ca fa ff ff       	call   f0100e93 <page_alloc>
f01013c9:	89 c6                	mov    %eax,%esi
f01013cb:	83 c4 10             	add    $0x10,%esp
f01013ce:	85 c0                	test   %eax,%eax
f01013d0:	0f 84 13 02 00 00    	je     f01015e9 <mem_init+0x39f>
	assert((pp2 = page_alloc(0)));
f01013d6:	83 ec 0c             	sub    $0xc,%esp
f01013d9:	6a 00                	push   $0x0
f01013db:	e8 b3 fa ff ff       	call   f0100e93 <page_alloc>
f01013e0:	89 c7                	mov    %eax,%edi
f01013e2:	83 c4 10             	add    $0x10,%esp
f01013e5:	85 c0                	test   %eax,%eax
f01013e7:	0f 84 15 02 00 00    	je     f0101602 <mem_init+0x3b8>
	assert(pp1 && pp1 != pp0);
f01013ed:	39 f3                	cmp    %esi,%ebx
f01013ef:	0f 84 26 02 00 00    	je     f010161b <mem_init+0x3d1>
	assert(pp2 && pp2 != pp1 && pp2 != pp0);
f01013f5:	39 c6                	cmp    %eax,%esi
f01013f7:	0f 84 37 02 00 00    	je     f0101634 <mem_init+0x3ea>
f01013fd:	39 c3                	cmp    %eax,%ebx
f01013ff:	0f 84 2f 02 00 00    	je     f0101634 <mem_init+0x3ea>
	return (pp - pages) << PGSHIFT;
f0101405:	8b 0d 90 7e 21 f0    	mov    0xf0217e90,%ecx
	assert(page2pa(pp0) < npages*PGSIZE);
f010140b:	8b 15 88 7e 21 f0    	mov    0xf0217e88,%edx
f0101411:	c1 e2 0c             	shl    $0xc,%edx
f0101414:	89 d8                	mov    %ebx,%eax
f0101416:	29 c8                	sub    %ecx,%eax
f0101418:	c1 f8 03             	sar    $0x3,%eax
f010141b:	c1 e0 0c             	shl    $0xc,%eax
f010141e:	39 d0                	cmp    %edx,%eax
f0101420:	0f 83 27 02 00 00    	jae    f010164d <mem_init+0x403>
f0101426:	89 f0                	mov    %esi,%eax
f0101428:	29 c8                	sub    %ecx,%eax
f010142a:	c1 f8 03             	sar    $0x3,%eax
f010142d:	c1 e0 0c             	shl    $0xc,%eax
	assert(page2pa(pp1) < npages*PGSIZE);
f0101430:	39 c2                	cmp    %eax,%edx
f0101432:	0f 86 2e 02 00 00    	jbe    f0101666 <mem_init+0x41c>
f0101438:	89 f8                	mov    %edi,%eax
f010143a:	29 c8                	sub    %ecx,%eax
f010143c:	c1 f8 03             	sar    $0x3,%eax
f010143f:	c1 e0 0c             	shl    $0xc,%eax
	assert(page2pa(pp2) < npages*PGSIZE);
f0101442:	39 c2                	cmp    %eax,%edx
f0101444:	0f 86 35 02 00 00    	jbe    f010167f <mem_init+0x435>
	fl = page_free_list;
f010144a:	a1 40 72 21 f0       	mov    0xf0217240,%eax
f010144f:	89 45 d0             	mov    %eax,-0x30(%ebp)
	page_free_list = 0;
f0101452:	c7 05 40 72 21 f0 00 	movl   $0x0,0xf0217240
f0101459:	00 00 00 
	assert(!page_alloc(0));
f010145c:	83 ec 0c             	sub    $0xc,%esp
f010145f:	6a 00                	push   $0x0
f0101461:	e8 2d fa ff ff       	call   f0100e93 <page_alloc>
f0101466:	83 c4 10             	add    $0x10,%esp
f0101469:	85 c0                	test   %eax,%eax
f010146b:	0f 85 27 02 00 00    	jne    f0101698 <mem_init+0x44e>
	page_free(pp0);
f0101471:	83 ec 0c             	sub    $0xc,%esp
f0101474:	53                   	push   %ebx
f0101475:	e8 92 fa ff ff       	call   f0100f0c <page_free>
	page_free(pp1);
f010147a:	89 34 24             	mov    %esi,(%esp)
f010147d:	e8 8a fa ff ff       	call   f0100f0c <page_free>
	page_free(pp2);
f0101482:	89 3c 24             	mov    %edi,(%esp)
f0101485:	e8 82 fa ff ff       	call   f0100f0c <page_free>
	assert((pp0 = page_alloc(0)));
f010148a:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
f0101491:	e8 fd f9 ff ff       	call   f0100e93 <page_alloc>
f0101496:	89 c3                	mov    %eax,%ebx
f0101498:	83 c4 10             	add    $0x10,%esp
f010149b:	85 c0                	test   %eax,%eax
f010149d:	0f 84 0e 02 00 00    	je     f01016b1 <mem_init+0x467>
	assert((pp1 = page_alloc(0)));
f01014a3:	83 ec 0c             	sub    $0xc,%esp
f01014a6:	6a 00                	push   $0x0
f01014a8:	e8 e6 f9 ff ff       	call   f0100e93 <page_alloc>
f01014ad:	89 c6                	mov    %eax,%esi
f01014af:	83 c4 10             	add    $0x10,%esp
f01014b2:	85 c0                	test   %eax,%eax
f01014b4:	0f 84 10 02 00 00    	je     f01016ca <mem_init+0x480>
	assert((pp2 = page_alloc(0)));
f01014ba:	83 ec 0c             	sub    $0xc,%esp
f01014bd:	6a 00                	push   $0x0
f01014bf:	e8 cf f9 ff ff       	call   f0100e93 <page_alloc>
f01014c4:	89 c7                	mov    %eax,%edi
f01014c6:	83 c4 10             	add    $0x10,%esp
f01014c9:	85 c0                	test   %eax,%eax
f01014cb:	0f 84 12 02 00 00    	je     f01016e3 <mem_init+0x499>
	assert(pp1 && pp1 != pp0);
f01014d1:	39 f3                	cmp    %esi,%ebx
f01014d3:	0f 84 23 02 00 00    	je     f01016fc <mem_init+0x4b2>
	assert(pp2 && pp2 != pp1 && pp2 != pp0);
f01014d9:	39 c3                	cmp    %eax,%ebx
f01014db:	0f 84 34 02 00 00    	je     f0101715 <mem_init+0x4cb>
f01014e1:	39 c6                	cmp    %eax,%esi
f01014e3:	0f 84 2c 02 00 00    	je     f0101715 <mem_init+0x4cb>
	assert(!page_alloc(0));
f01014e9:	83 ec 0c             	sub    $0xc,%esp
f01014ec:	6a 00                	push   $0x0
f01014ee:	e8 a0 f9 ff ff       	call   f0100e93 <page_alloc>
f01014f3:	83 c4 10             	add    $0x10,%esp
f01014f6:	85 c0                	test   %eax,%eax
f01014f8:	0f 85 30 02 00 00    	jne    f010172e <mem_init+0x4e4>
f01014fe:	89 d8                	mov    %ebx,%eax
f0101500:	2b 05 90 7e 21 f0    	sub    0xf0217e90,%eax
f0101506:	c1 f8 03             	sar    $0x3,%eax
f0101509:	89 c2                	mov    %eax,%edx
f010150b:	c1 e2 0c             	shl    $0xc,%edx
	if (PGNUM(pa) >= npages)
f010150e:	25 ff ff 0f 00       	and    $0xfffff,%eax
f0101513:	3b 05 88 7e 21 f0    	cmp    0xf0217e88,%eax
f0101519:	0f 83 28 02 00 00    	jae    f0101747 <mem_init+0x4fd>
	memset(page2kva(pp0), 1, PGSIZE);
f010151f:	83 ec 04             	sub    $0x4,%esp
f0101522:	68 00 10 00 00       	push   $0x1000
f0101527:	6a 01                	push   $0x1
	return (void *)(pa + KERNBASE);
f0101529:	81 ea 00 00 00 10    	sub    $0x10000000,%edx
f010152f:	52                   	push   %edx
f0101530:	e8 b5 43 00 00       	call   f01058ea <memset>
	page_free(pp0);
f0101535:	89 1c 24             	mov    %ebx,(%esp)
f0101538:	e8 cf f9 ff ff       	call   f0100f0c <page_free>
	assert((pp = page_alloc(ALLOC_ZERO)));
f010153d:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
f0101544:	e8 4a f9 ff ff       	call   f0100e93 <page_alloc>
f0101549:	83 c4 10             	add    $0x10,%esp
f010154c:	85 c0                	test   %eax,%eax
f010154e:	0f 84 05 02 00 00    	je     f0101759 <mem_init+0x50f>
	assert(pp && pp0 == pp);
f0101554:	39 c3                	cmp    %eax,%ebx
f0101556:	0f 85 16 02 00 00    	jne    f0101772 <mem_init+0x528>
	return (pp - pages) << PGSHIFT;
f010155c:	2b 05 90 7e 21 f0    	sub    0xf0217e90,%eax
f0101562:	c1 f8 03             	sar    $0x3,%eax
f0101565:	89 c2                	mov    %eax,%edx
f0101567:	c1 e2 0c             	shl    $0xc,%edx
	if (PGNUM(pa) >= npages)
f010156a:	25 ff ff 0f 00       	and    $0xfffff,%eax
f010156f:	3b 05 88 7e 21 f0    	cmp    0xf0217e88,%eax
f0101575:	0f 83 10 02 00 00    	jae    f010178b <mem_init+0x541>
	return (void *)(pa + KERNBASE);
f010157b:	8d 82 00 00 00 f0    	lea    -0x10000000(%edx),%eax
f0101581:	81 ea 00 f0 ff 0f    	sub    $0xffff000,%edx
		assert(c[i] == 0);
f0101587:	80 38 00             	cmpb   $0x0,(%eax)
f010158a:	0f 85 0d 02 00 00    	jne    f010179d <mem_init+0x553>
f0101590:	83 c0 01             	add    $0x1,%eax
	for (i = 0; i < PGSIZE; i++)
f0101593:	39 d0                	cmp    %edx,%eax
f0101595:	75 f0                	jne    f0101587 <mem_init+0x33d>
	page_free_list = fl;
f0101597:	8b 45 d0             	mov    -0x30(%ebp),%eax
f010159a:	a3 40 72 21 f0       	mov    %eax,0xf0217240
	page_free(pp0);
f010159f:	83 ec 0c             	sub    $0xc,%esp
f01015a2:	53                   	push   %ebx
f01015a3:	e8 64 f9 ff ff       	call   f0100f0c <page_free>
	page_free(pp1);
f01015a8:	89 34 24             	mov    %esi,(%esp)
f01015ab:	e8 5c f9 ff ff       	call   f0100f0c <page_free>
	page_free(pp2);
f01015b0:	89 3c 24             	mov    %edi,(%esp)
f01015b3:	e8 54 f9 ff ff       	call   f0100f0c <page_free>
	for (pp = page_free_list; pp; pp = pp->pp_link)
f01015b8:	a1 40 72 21 f0       	mov    0xf0217240,%eax
f01015bd:	83 c4 10             	add    $0x10,%esp
f01015c0:	85 c0                	test   %eax,%eax
f01015c2:	0f 84 ee 01 00 00    	je     f01017b6 <mem_init+0x56c>
		--nfree;
f01015c8:	83 6d d4 01          	subl   $0x1,-0x2c(%ebp)
	for (pp = page_free_list; pp; pp = pp->pp_link)
f01015cc:	8b 00                	mov    (%eax),%eax
f01015ce:	eb f0                	jmp    f01015c0 <mem_init+0x376>
	assert((pp0 = page_alloc(0)));
f01015d0:	68 13 75 10 f0       	push   $0xf0107513
f01015d5:	68 47 74 10 f0       	push   $0xf0107447
f01015da:	68 36 03 00 00       	push   $0x336
f01015df:	68 21 74 10 f0       	push   $0xf0107421
f01015e4:	e8 57 ea ff ff       	call   f0100040 <_panic>
	assert((pp1 = page_alloc(0)));
f01015e9:	68 29 75 10 f0       	push   $0xf0107529
f01015ee:	68 47 74 10 f0       	push   $0xf0107447
f01015f3:	68 37 03 00 00       	push   $0x337
f01015f8:	68 21 74 10 f0       	push   $0xf0107421
f01015fd:	e8 3e ea ff ff       	call   f0100040 <_panic>
	assert((pp2 = page_alloc(0)));
f0101602:	68 3f 75 10 f0       	push   $0xf010753f
f0101607:	68 47 74 10 f0       	push   $0xf0107447
f010160c:	68 38 03 00 00       	push   $0x338
f0101611:	68 21 74 10 f0       	push   $0xf0107421
f0101616:	e8 25 ea ff ff       	call   f0100040 <_panic>
	assert(pp1 && pp1 != pp0);
f010161b:	68 55 75 10 f0       	push   $0xf0107555
f0101620:	68 47 74 10 f0       	push   $0xf0107447
f0101625:	68 3b 03 00 00       	push   $0x33b
f010162a:	68 21 74 10 f0       	push   $0xf0107421
f010162f:	e8 0c ea ff ff       	call   f0100040 <_panic>
	assert(pp2 && pp2 != pp1 && pp2 != pp0);
f0101634:	68 44 6c 10 f0       	push   $0xf0106c44
f0101639:	68 47 74 10 f0       	push   $0xf0107447
f010163e:	68 3c 03 00 00       	push   $0x33c
f0101643:	68 21 74 10 f0       	push   $0xf0107421
f0101648:	e8 f3 e9 ff ff       	call   f0100040 <_panic>
	assert(page2pa(pp0) < npages*PGSIZE);
f010164d:	68 67 75 10 f0       	push   $0xf0107567
f0101652:	68 47 74 10 f0       	push   $0xf0107447
f0101657:	68 3d 03 00 00       	push   $0x33d
f010165c:	68 21 74 10 f0       	push   $0xf0107421
f0101661:	e8 da e9 ff ff       	call   f0100040 <_panic>
	assert(page2pa(pp1) < npages*PGSIZE);
f0101666:	68 84 75 10 f0       	push   $0xf0107584
f010166b:	68 47 74 10 f0       	push   $0xf0107447
f0101670:	68 3e 03 00 00       	push   $0x33e
f0101675:	68 21 74 10 f0       	push   $0xf0107421
f010167a:	e8 c1 e9 ff ff       	call   f0100040 <_panic>
	assert(page2pa(pp2) < npages*PGSIZE);
f010167f:	68 a1 75 10 f0       	push   $0xf01075a1
f0101684:	68 47 74 10 f0       	push   $0xf0107447
f0101689:	68 3f 03 00 00       	push   $0x33f
f010168e:	68 21 74 10 f0       	push   $0xf0107421
f0101693:	e8 a8 e9 ff ff       	call   f0100040 <_panic>
	assert(!page_alloc(0));
f0101698:	68 be 75 10 f0       	push   $0xf01075be
f010169d:	68 47 74 10 f0       	push   $0xf0107447
f01016a2:	68 46 03 00 00       	push   $0x346
f01016a7:	68 21 74 10 f0       	push   $0xf0107421
f01016ac:	e8 8f e9 ff ff       	call   f0100040 <_panic>
	assert((pp0 = page_alloc(0)));
f01016b1:	68 13 75 10 f0       	push   $0xf0107513
f01016b6:	68 47 74 10 f0       	push   $0xf0107447
f01016bb:	68 4d 03 00 00       	push   $0x34d
f01016c0:	68 21 74 10 f0       	push   $0xf0107421
f01016c5:	e8 76 e9 ff ff       	call   f0100040 <_panic>
	assert((pp1 = page_alloc(0)));
f01016ca:	68 29 75 10 f0       	push   $0xf0107529
f01016cf:	68 47 74 10 f0       	push   $0xf0107447
f01016d4:	68 4e 03 00 00       	push   $0x34e
f01016d9:	68 21 74 10 f0       	push   $0xf0107421
f01016de:	e8 5d e9 ff ff       	call   f0100040 <_panic>
	assert((pp2 = page_alloc(0)));
f01016e3:	68 3f 75 10 f0       	push   $0xf010753f
f01016e8:	68 47 74 10 f0       	push   $0xf0107447
f01016ed:	68 4f 03 00 00       	push   $0x34f
f01016f2:	68 21 74 10 f0       	push   $0xf0107421
f01016f7:	e8 44 e9 ff ff       	call   f0100040 <_panic>
	assert(pp1 && pp1 != pp0);
f01016fc:	68 55 75 10 f0       	push   $0xf0107555
f0101701:	68 47 74 10 f0       	push   $0xf0107447
f0101706:	68 51 03 00 00       	push   $0x351
f010170b:	68 21 74 10 f0       	push   $0xf0107421
f0101710:	e8 2b e9 ff ff       	call   f0100040 <_panic>
	assert(pp2 && pp2 != pp1 && pp2 != pp0);
f0101715:	68 44 6c 10 f0       	push   $0xf0106c44
f010171a:	68 47 74 10 f0       	push   $0xf0107447
f010171f:	68 52 03 00 00       	push   $0x352
f0101724:	68 21 74 10 f0       	push   $0xf0107421
f0101729:	e8 12 e9 ff ff       	call   f0100040 <_panic>
	assert(!page_alloc(0));
f010172e:	68 be 75 10 f0       	push   $0xf01075be
f0101733:	68 47 74 10 f0       	push   $0xf0107447
f0101738:	68 53 03 00 00       	push   $0x353
f010173d:	68 21 74 10 f0       	push   $0xf0107421
f0101742:	e8 f9 e8 ff ff       	call   f0100040 <_panic>
		_panic(file, line, "KADDR called with invalid pa %08lx", pa);
f0101747:	52                   	push   %edx
f0101748:	68 a4 65 10 f0       	push   $0xf01065a4
f010174d:	6a 58                	push   $0x58
f010174f:	68 2d 74 10 f0       	push   $0xf010742d
f0101754:	e8 e7 e8 ff ff       	call   f0100040 <_panic>
	assert((pp = page_alloc(ALLOC_ZERO)));
f0101759:	68 cd 75 10 f0       	push   $0xf01075cd
f010175e:	68 47 74 10 f0       	push   $0xf0107447
f0101763:	68 58 03 00 00       	push   $0x358
f0101768:	68 21 74 10 f0       	push   $0xf0107421
f010176d:	e8 ce e8 ff ff       	call   f0100040 <_panic>
	assert(pp && pp0 == pp);
f0101772:	68 eb 75 10 f0       	push   $0xf01075eb
f0101777:	68 47 74 10 f0       	push   $0xf0107447
f010177c:	68 59 03 00 00       	push   $0x359
f0101781:	68 21 74 10 f0       	push   $0xf0107421
f0101786:	e8 b5 e8 ff ff       	call   f0100040 <_panic>
f010178b:	52                   	push   %edx
f010178c:	68 a4 65 10 f0       	push   $0xf01065a4
f0101791:	6a 58                	push   $0x58
f0101793:	68 2d 74 10 f0       	push   $0xf010742d
f0101798:	e8 a3 e8 ff ff       	call   f0100040 <_panic>
		assert(c[i] == 0);
f010179d:	68 fb 75 10 f0       	push   $0xf01075fb
f01017a2:	68 47 74 10 f0       	push   $0xf0107447
f01017a7:	68 5c 03 00 00       	push   $0x35c
f01017ac:	68 21 74 10 f0       	push   $0xf0107421
f01017b1:	e8 8a e8 ff ff       	call   f0100040 <_panic>
	assert(nfree == 0);
f01017b6:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
f01017ba:	0f 85 43 09 00 00    	jne    f0102103 <mem_init+0xeb9>
	cprintf("check_page_alloc() succeeded!\n");
f01017c0:	83 ec 0c             	sub    $0xc,%esp
f01017c3:	68 64 6c 10 f0       	push   $0xf0106c64
f01017c8:	e8 10 20 00 00       	call   f01037dd <cprintf>
	int i;
	extern pde_t entry_pgdir[];

	// should be able to allocate three pages
	pp0 = pp1 = pp2 = 0;
	assert((pp0 = page_alloc(0)));
f01017cd:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
f01017d4:	e8 ba f6 ff ff       	call   f0100e93 <page_alloc>
f01017d9:	89 45 d4             	mov    %eax,-0x2c(%ebp)
f01017dc:	83 c4 10             	add    $0x10,%esp
f01017df:	85 c0                	test   %eax,%eax
f01017e1:	0f 84 35 09 00 00    	je     f010211c <mem_init+0xed2>
	assert((pp1 = page_alloc(0)));
f01017e7:	83 ec 0c             	sub    $0xc,%esp
f01017ea:	6a 00                	push   $0x0
f01017ec:	e8 a2 f6 ff ff       	call   f0100e93 <page_alloc>
f01017f1:	89 c7                	mov    %eax,%edi
f01017f3:	83 c4 10             	add    $0x10,%esp
f01017f6:	85 c0                	test   %eax,%eax
f01017f8:	0f 84 37 09 00 00    	je     f0102135 <mem_init+0xeeb>
	assert((pp2 = page_alloc(0)));
f01017fe:	83 ec 0c             	sub    $0xc,%esp
f0101801:	6a 00                	push   $0x0
f0101803:	e8 8b f6 ff ff       	call   f0100e93 <page_alloc>
f0101808:	89 c3                	mov    %eax,%ebx
f010180a:	83 c4 10             	add    $0x10,%esp
f010180d:	85 c0                	test   %eax,%eax
f010180f:	0f 84 39 09 00 00    	je     f010214e <mem_init+0xf04>

	assert(pp0);
	assert(pp1 && pp1 != pp0);
f0101815:	39 7d d4             	cmp    %edi,-0x2c(%ebp)
f0101818:	0f 84 49 09 00 00    	je     f0102167 <mem_init+0xf1d>
	assert(pp2 && pp2 != pp1 && pp2 != pp0);
f010181e:	39 45 d4             	cmp    %eax,-0x2c(%ebp)
f0101821:	0f 84 59 09 00 00    	je     f0102180 <mem_init+0xf36>
f0101827:	39 c7                	cmp    %eax,%edi
f0101829:	0f 84 51 09 00 00    	je     f0102180 <mem_init+0xf36>

	// temporarily steal the rest of the free pages
	fl = page_free_list;
f010182f:	a1 40 72 21 f0       	mov    0xf0217240,%eax
f0101834:	89 45 cc             	mov    %eax,-0x34(%ebp)
	page_free_list = 0;
f0101837:	c7 05 40 72 21 f0 00 	movl   $0x0,0xf0217240
f010183e:	00 00 00 

	// should be no free memory
	assert(!page_alloc(0));
f0101841:	83 ec 0c             	sub    $0xc,%esp
f0101844:	6a 00                	push   $0x0
f0101846:	e8 48 f6 ff ff       	call   f0100e93 <page_alloc>
f010184b:	83 c4 10             	add    $0x10,%esp
f010184e:	85 c0                	test   %eax,%eax
f0101850:	0f 85 43 09 00 00    	jne    f0102199 <mem_init+0xf4f>

	// there is no page allocated at address 0
	assert(page_lookup(kern_pgdir, (void *) 0x0, &ptep) == NULL);
f0101856:	83 ec 04             	sub    $0x4,%esp
f0101859:	8d 45 e4             	lea    -0x1c(%ebp),%eax
f010185c:	50                   	push   %eax
f010185d:	6a 00                	push   $0x0
f010185f:	ff 35 8c 7e 21 f0    	pushl  0xf0217e8c
f0101865:	e8 0a f8 ff ff       	call   f0101074 <page_lookup>
f010186a:	83 c4 10             	add    $0x10,%esp
f010186d:	85 c0                	test   %eax,%eax
f010186f:	0f 85 3d 09 00 00    	jne    f01021b2 <mem_init+0xf68>

	// there is no free memory, so we can't allocate a page table
	assert(page_insert(kern_pgdir, pp1, 0x0, PTE_W) < 0);
f0101875:	6a 02                	push   $0x2
f0101877:	6a 00                	push   $0x0
f0101879:	57                   	push   %edi
f010187a:	ff 35 8c 7e 21 f0    	pushl  0xf0217e8c
f0101880:	e8 d4 f8 ff ff       	call   f0101159 <page_insert>
f0101885:	83 c4 10             	add    $0x10,%esp
f0101888:	85 c0                	test   %eax,%eax
f010188a:	0f 89 3b 09 00 00    	jns    f01021cb <mem_init+0xf81>

	// free pp0 and try again: pp0 should be used for page table
	page_free(pp0);
f0101890:	83 ec 0c             	sub    $0xc,%esp
f0101893:	ff 75 d4             	pushl  -0x2c(%ebp)
f0101896:	e8 71 f6 ff ff       	call   f0100f0c <page_free>
	assert(page_insert(kern_pgdir, pp1, 0x0, PTE_W) == 0);
f010189b:	6a 02                	push   $0x2
f010189d:	6a 00                	push   $0x0
f010189f:	57                   	push   %edi
f01018a0:	ff 35 8c 7e 21 f0    	pushl  0xf0217e8c
f01018a6:	e8 ae f8 ff ff       	call   f0101159 <page_insert>
f01018ab:	83 c4 20             	add    $0x20,%esp
f01018ae:	85 c0                	test   %eax,%eax
f01018b0:	0f 85 2e 09 00 00    	jne    f01021e4 <mem_init+0xf9a>
	assert(PTE_ADDR(kern_pgdir[0]) == page2pa(pp0));
f01018b6:	8b 35 8c 7e 21 f0    	mov    0xf0217e8c,%esi
	return (pp - pages) << PGSHIFT;
f01018bc:	8b 0d 90 7e 21 f0    	mov    0xf0217e90,%ecx
f01018c2:	89 4d d0             	mov    %ecx,-0x30(%ebp)
f01018c5:	8b 16                	mov    (%esi),%edx
f01018c7:	81 e2 00 f0 ff ff    	and    $0xfffff000,%edx
f01018cd:	8b 45 d4             	mov    -0x2c(%ebp),%eax
f01018d0:	29 c8                	sub    %ecx,%eax
f01018d2:	c1 f8 03             	sar    $0x3,%eax
f01018d5:	c1 e0 0c             	shl    $0xc,%eax
f01018d8:	39 c2                	cmp    %eax,%edx
f01018da:	0f 85 1d 09 00 00    	jne    f01021fd <mem_init+0xfb3>
	assert(check_va2pa(kern_pgdir, 0x0) == page2pa(pp1));
f01018e0:	ba 00 00 00 00       	mov    $0x0,%edx
f01018e5:	89 f0                	mov    %esi,%eax
f01018e7:	e8 9b f1 ff ff       	call   f0100a87 <check_va2pa>
f01018ec:	89 c2                	mov    %eax,%edx
f01018ee:	89 f8                	mov    %edi,%eax
f01018f0:	2b 45 d0             	sub    -0x30(%ebp),%eax
f01018f3:	c1 f8 03             	sar    $0x3,%eax
f01018f6:	c1 e0 0c             	shl    $0xc,%eax
f01018f9:	39 c2                	cmp    %eax,%edx
f01018fb:	0f 85 15 09 00 00    	jne    f0102216 <mem_init+0xfcc>
	assert(pp1->pp_ref == 1);
f0101901:	66 83 7f 04 01       	cmpw   $0x1,0x4(%edi)
f0101906:	0f 85 23 09 00 00    	jne    f010222f <mem_init+0xfe5>
	assert(pp0->pp_ref == 1);
f010190c:	8b 45 d4             	mov    -0x2c(%ebp),%eax
f010190f:	66 83 78 04 01       	cmpw   $0x1,0x4(%eax)
f0101914:	0f 85 2e 09 00 00    	jne    f0102248 <mem_init+0xffe>

	// should be able to map pp2 at PGSIZE because pp0 is already allocated for page table
	assert(page_insert(kern_pgdir, pp2, (void*) PGSIZE, PTE_W) == 0);
f010191a:	6a 02                	push   $0x2
f010191c:	68 00 10 00 00       	push   $0x1000
f0101921:	53                   	push   %ebx
f0101922:	56                   	push   %esi
f0101923:	e8 31 f8 ff ff       	call   f0101159 <page_insert>
f0101928:	83 c4 10             	add    $0x10,%esp
f010192b:	85 c0                	test   %eax,%eax
f010192d:	0f 85 2e 09 00 00    	jne    f0102261 <mem_init+0x1017>
	assert(check_va2pa(kern_pgdir, PGSIZE) == page2pa(pp2));
f0101933:	ba 00 10 00 00       	mov    $0x1000,%edx
f0101938:	a1 8c 7e 21 f0       	mov    0xf0217e8c,%eax
f010193d:	e8 45 f1 ff ff       	call   f0100a87 <check_va2pa>
f0101942:	89 c2                	mov    %eax,%edx
f0101944:	89 d8                	mov    %ebx,%eax
f0101946:	2b 05 90 7e 21 f0    	sub    0xf0217e90,%eax
f010194c:	c1 f8 03             	sar    $0x3,%eax
f010194f:	c1 e0 0c             	shl    $0xc,%eax
f0101952:	39 c2                	cmp    %eax,%edx
f0101954:	0f 85 20 09 00 00    	jne    f010227a <mem_init+0x1030>
	assert(pp2->pp_ref == 1);
f010195a:	66 83 7b 04 01       	cmpw   $0x1,0x4(%ebx)
f010195f:	0f 85 2e 09 00 00    	jne    f0102293 <mem_init+0x1049>

	// should be no free memory
	assert(!page_alloc(0));
f0101965:	83 ec 0c             	sub    $0xc,%esp
f0101968:	6a 00                	push   $0x0
f010196a:	e8 24 f5 ff ff       	call   f0100e93 <page_alloc>
f010196f:	83 c4 10             	add    $0x10,%esp
f0101972:	85 c0                	test   %eax,%eax
f0101974:	0f 85 32 09 00 00    	jne    f01022ac <mem_init+0x1062>

	// should be able to map pp2 at PGSIZE because it's already there
	assert(page_insert(kern_pgdir, pp2, (void*) PGSIZE, PTE_W) == 0);
f010197a:	6a 02                	push   $0x2
f010197c:	68 00 10 00 00       	push   $0x1000
f0101981:	53                   	push   %ebx
f0101982:	ff 35 8c 7e 21 f0    	pushl  0xf0217e8c
f0101988:	e8 cc f7 ff ff       	call   f0101159 <page_insert>
f010198d:	83 c4 10             	add    $0x10,%esp
f0101990:	85 c0                	test   %eax,%eax
f0101992:	0f 85 2d 09 00 00    	jne    f01022c5 <mem_init+0x107b>
	assert(check_va2pa(kern_pgdir, PGSIZE) == page2pa(pp2));
f0101998:	ba 00 10 00 00       	mov    $0x1000,%edx
f010199d:	a1 8c 7e 21 f0       	mov    0xf0217e8c,%eax
f01019a2:	e8 e0 f0 ff ff       	call   f0100a87 <check_va2pa>
f01019a7:	89 c2                	mov    %eax,%edx
f01019a9:	89 d8                	mov    %ebx,%eax
f01019ab:	2b 05 90 7e 21 f0    	sub    0xf0217e90,%eax
f01019b1:	c1 f8 03             	sar    $0x3,%eax
f01019b4:	c1 e0 0c             	shl    $0xc,%eax
f01019b7:	39 c2                	cmp    %eax,%edx
f01019b9:	0f 85 1f 09 00 00    	jne    f01022de <mem_init+0x1094>
	assert(pp2->pp_ref == 1);
f01019bf:	66 83 7b 04 01       	cmpw   $0x1,0x4(%ebx)
f01019c4:	0f 85 2d 09 00 00    	jne    f01022f7 <mem_init+0x10ad>

	// pp2 should NOT be on the free list
	// could happen in ref counts are handled sloppily in page_insert
	assert(!page_alloc(0));
f01019ca:	83 ec 0c             	sub    $0xc,%esp
f01019cd:	6a 00                	push   $0x0
f01019cf:	e8 bf f4 ff ff       	call   f0100e93 <page_alloc>
f01019d4:	83 c4 10             	add    $0x10,%esp
f01019d7:	85 c0                	test   %eax,%eax
f01019d9:	0f 85 31 09 00 00    	jne    f0102310 <mem_init+0x10c6>

	// check that pgdir_walk returns a pointer to the pte
	ptep = (pte_t *) KADDR(PTE_ADDR(kern_pgdir[PDX(PGSIZE)]));
f01019df:	8b 0d 8c 7e 21 f0    	mov    0xf0217e8c,%ecx
f01019e5:	8b 01                	mov    (%ecx),%eax
f01019e7:	89 c2                	mov    %eax,%edx
f01019e9:	81 e2 00 f0 ff ff    	and    $0xfffff000,%edx
	if (PGNUM(pa) >= npages)
f01019ef:	c1 e8 0c             	shr    $0xc,%eax
f01019f2:	3b 05 88 7e 21 f0    	cmp    0xf0217e88,%eax
f01019f8:	0f 83 2b 09 00 00    	jae    f0102329 <mem_init+0x10df>
	return (void *)(pa + KERNBASE);
f01019fe:	81 ea 00 00 00 10    	sub    $0x10000000,%edx
f0101a04:	89 55 e4             	mov    %edx,-0x1c(%ebp)
	assert(pgdir_walk(kern_pgdir, (void*)PGSIZE, 0) == ptep+PTX(PGSIZE));
f0101a07:	83 ec 04             	sub    $0x4,%esp
f0101a0a:	6a 00                	push   $0x0
f0101a0c:	68 00 10 00 00       	push   $0x1000
f0101a11:	51                   	push   %ecx
f0101a12:	e8 61 f5 ff ff       	call   f0100f78 <pgdir_walk>
f0101a17:	89 c2                	mov    %eax,%edx
f0101a19:	8b 45 e4             	mov    -0x1c(%ebp),%eax
f0101a1c:	83 c0 04             	add    $0x4,%eax
f0101a1f:	83 c4 10             	add    $0x10,%esp
f0101a22:	39 d0                	cmp    %edx,%eax
f0101a24:	0f 85 14 09 00 00    	jne    f010233e <mem_init+0x10f4>

	// should be able to change permissions too.
	assert(page_insert(kern_pgdir, pp2, (void*) PGSIZE, PTE_W|PTE_U) == 0);
f0101a2a:	6a 06                	push   $0x6
f0101a2c:	68 00 10 00 00       	push   $0x1000
f0101a31:	53                   	push   %ebx
f0101a32:	ff 35 8c 7e 21 f0    	pushl  0xf0217e8c
f0101a38:	e8 1c f7 ff ff       	call   f0101159 <page_insert>
f0101a3d:	83 c4 10             	add    $0x10,%esp
f0101a40:	85 c0                	test   %eax,%eax
f0101a42:	0f 85 0f 09 00 00    	jne    f0102357 <mem_init+0x110d>
	assert(check_va2pa(kern_pgdir, PGSIZE) == page2pa(pp2));
f0101a48:	8b 35 8c 7e 21 f0    	mov    0xf0217e8c,%esi
f0101a4e:	ba 00 10 00 00       	mov    $0x1000,%edx
f0101a53:	89 f0                	mov    %esi,%eax
f0101a55:	e8 2d f0 ff ff       	call   f0100a87 <check_va2pa>
f0101a5a:	89 c2                	mov    %eax,%edx
	return (pp - pages) << PGSHIFT;
f0101a5c:	89 d8                	mov    %ebx,%eax
f0101a5e:	2b 05 90 7e 21 f0    	sub    0xf0217e90,%eax
f0101a64:	c1 f8 03             	sar    $0x3,%eax
f0101a67:	c1 e0 0c             	shl    $0xc,%eax
f0101a6a:	39 c2                	cmp    %eax,%edx
f0101a6c:	0f 85 fe 08 00 00    	jne    f0102370 <mem_init+0x1126>
	assert(pp2->pp_ref == 1);
f0101a72:	66 83 7b 04 01       	cmpw   $0x1,0x4(%ebx)
f0101a77:	0f 85 0c 09 00 00    	jne    f0102389 <mem_init+0x113f>
	assert(*pgdir_walk(kern_pgdir, (void*) PGSIZE, 0) & PTE_U);
f0101a7d:	83 ec 04             	sub    $0x4,%esp
f0101a80:	6a 00                	push   $0x0
f0101a82:	68 00 10 00 00       	push   $0x1000
f0101a87:	56                   	push   %esi
f0101a88:	e8 eb f4 ff ff       	call   f0100f78 <pgdir_walk>
f0101a8d:	83 c4 10             	add    $0x10,%esp
f0101a90:	f6 00 04             	testb  $0x4,(%eax)
f0101a93:	0f 84 09 09 00 00    	je     f01023a2 <mem_init+0x1158>
	assert(kern_pgdir[0] & PTE_U);
f0101a99:	a1 8c 7e 21 f0       	mov    0xf0217e8c,%eax
f0101a9e:	f6 00 04             	testb  $0x4,(%eax)
f0101aa1:	0f 84 14 09 00 00    	je     f01023bb <mem_init+0x1171>

	// should be able to remap with fewer permissions
	assert(page_insert(kern_pgdir, pp2, (void*) PGSIZE, PTE_W) == 0);
f0101aa7:	6a 02                	push   $0x2
f0101aa9:	68 00 10 00 00       	push   $0x1000
f0101aae:	53                   	push   %ebx
f0101aaf:	50                   	push   %eax
f0101ab0:	e8 a4 f6 ff ff       	call   f0101159 <page_insert>
f0101ab5:	83 c4 10             	add    $0x10,%esp
f0101ab8:	85 c0                	test   %eax,%eax
f0101aba:	0f 85 14 09 00 00    	jne    f01023d4 <mem_init+0x118a>
	assert(*pgdir_walk(kern_pgdir, (void*) PGSIZE, 0) & PTE_W);
f0101ac0:	83 ec 04             	sub    $0x4,%esp
f0101ac3:	6a 00                	push   $0x0
f0101ac5:	68 00 10 00 00       	push   $0x1000
f0101aca:	ff 35 8c 7e 21 f0    	pushl  0xf0217e8c
f0101ad0:	e8 a3 f4 ff ff       	call   f0100f78 <pgdir_walk>
f0101ad5:	83 c4 10             	add    $0x10,%esp
f0101ad8:	f6 00 02             	testb  $0x2,(%eax)
f0101adb:	0f 84 0c 09 00 00    	je     f01023ed <mem_init+0x11a3>
	assert(!(*pgdir_walk(kern_pgdir, (void*) PGSIZE, 0) & PTE_U));
f0101ae1:	83 ec 04             	sub    $0x4,%esp
f0101ae4:	6a 00                	push   $0x0
f0101ae6:	68 00 10 00 00       	push   $0x1000
f0101aeb:	ff 35 8c 7e 21 f0    	pushl  0xf0217e8c
f0101af1:	e8 82 f4 ff ff       	call   f0100f78 <pgdir_walk>
f0101af6:	83 c4 10             	add    $0x10,%esp
f0101af9:	f6 00 04             	testb  $0x4,(%eax)
f0101afc:	0f 85 04 09 00 00    	jne    f0102406 <mem_init+0x11bc>

	// should not be able to map at PTSIZE because need free page for page table
	assert(page_insert(kern_pgdir, pp0, (void*) PTSIZE, PTE_W) < 0);
f0101b02:	6a 02                	push   $0x2
f0101b04:	68 00 00 40 00       	push   $0x400000
f0101b09:	ff 75 d4             	pushl  -0x2c(%ebp)
f0101b0c:	ff 35 8c 7e 21 f0    	pushl  0xf0217e8c
f0101b12:	e8 42 f6 ff ff       	call   f0101159 <page_insert>
f0101b17:	83 c4 10             	add    $0x10,%esp
f0101b1a:	85 c0                	test   %eax,%eax
f0101b1c:	0f 89 fd 08 00 00    	jns    f010241f <mem_init+0x11d5>

	// insert pp1 at PGSIZE (replacing pp2)
	assert(page_insert(kern_pgdir, pp1, (void*) PGSIZE, PTE_W) == 0);
f0101b22:	6a 02                	push   $0x2
f0101b24:	68 00 10 00 00       	push   $0x1000
f0101b29:	57                   	push   %edi
f0101b2a:	ff 35 8c 7e 21 f0    	pushl  0xf0217e8c
f0101b30:	e8 24 f6 ff ff       	call   f0101159 <page_insert>
f0101b35:	83 c4 10             	add    $0x10,%esp
f0101b38:	85 c0                	test   %eax,%eax
f0101b3a:	0f 85 f8 08 00 00    	jne    f0102438 <mem_init+0x11ee>
	assert(!(*pgdir_walk(kern_pgdir, (void*) PGSIZE, 0) & PTE_U));
f0101b40:	83 ec 04             	sub    $0x4,%esp
f0101b43:	6a 00                	push   $0x0
f0101b45:	68 00 10 00 00       	push   $0x1000
f0101b4a:	ff 35 8c 7e 21 f0    	pushl  0xf0217e8c
f0101b50:	e8 23 f4 ff ff       	call   f0100f78 <pgdir_walk>
f0101b55:	83 c4 10             	add    $0x10,%esp
f0101b58:	f6 00 04             	testb  $0x4,(%eax)
f0101b5b:	0f 85 f0 08 00 00    	jne    f0102451 <mem_init+0x1207>

	// should have pp1 at both 0 and PGSIZE, pp2 nowhere, ...
	assert(check_va2pa(kern_pgdir, 0) == page2pa(pp1));
f0101b61:	a1 8c 7e 21 f0       	mov    0xf0217e8c,%eax
f0101b66:	89 45 d0             	mov    %eax,-0x30(%ebp)
f0101b69:	ba 00 00 00 00       	mov    $0x0,%edx
f0101b6e:	e8 14 ef ff ff       	call   f0100a87 <check_va2pa>
f0101b73:	89 fe                	mov    %edi,%esi
f0101b75:	2b 35 90 7e 21 f0    	sub    0xf0217e90,%esi
f0101b7b:	c1 fe 03             	sar    $0x3,%esi
f0101b7e:	c1 e6 0c             	shl    $0xc,%esi
f0101b81:	39 f0                	cmp    %esi,%eax
f0101b83:	0f 85 e1 08 00 00    	jne    f010246a <mem_init+0x1220>
	assert(check_va2pa(kern_pgdir, PGSIZE) == page2pa(pp1));
f0101b89:	ba 00 10 00 00       	mov    $0x1000,%edx
f0101b8e:	8b 45 d0             	mov    -0x30(%ebp),%eax
f0101b91:	e8 f1 ee ff ff       	call   f0100a87 <check_va2pa>
f0101b96:	39 c6                	cmp    %eax,%esi
f0101b98:	0f 85 e5 08 00 00    	jne    f0102483 <mem_init+0x1239>
	// ... and ref counts should reflect this
	assert(pp1->pp_ref == 2);
f0101b9e:	66 83 7f 04 02       	cmpw   $0x2,0x4(%edi)
f0101ba3:	0f 85 f3 08 00 00    	jne    f010249c <mem_init+0x1252>
	assert(pp2->pp_ref == 0);
f0101ba9:	66 83 7b 04 00       	cmpw   $0x0,0x4(%ebx)
f0101bae:	0f 85 01 09 00 00    	jne    f01024b5 <mem_init+0x126b>

	// pp2 should be returned by page_alloc
	assert((pp = page_alloc(0)) && pp == pp2);
f0101bb4:	83 ec 0c             	sub    $0xc,%esp
f0101bb7:	6a 00                	push   $0x0
f0101bb9:	e8 d5 f2 ff ff       	call   f0100e93 <page_alloc>
f0101bbe:	83 c4 10             	add    $0x10,%esp
f0101bc1:	85 c0                	test   %eax,%eax
f0101bc3:	0f 84 05 09 00 00    	je     f01024ce <mem_init+0x1284>
f0101bc9:	39 c3                	cmp    %eax,%ebx
f0101bcb:	0f 85 fd 08 00 00    	jne    f01024ce <mem_init+0x1284>

	// unmapping pp1 at 0 should keep pp1 at PGSIZE
	page_remove(kern_pgdir, 0x0);
f0101bd1:	83 ec 08             	sub    $0x8,%esp
f0101bd4:	6a 00                	push   $0x0
f0101bd6:	ff 35 8c 7e 21 f0    	pushl  0xf0217e8c
f0101bdc:	e8 2e f5 ff ff       	call   f010110f <page_remove>
	assert(check_va2pa(kern_pgdir, 0x0) == ~0);
f0101be1:	8b 35 8c 7e 21 f0    	mov    0xf0217e8c,%esi
f0101be7:	ba 00 00 00 00       	mov    $0x0,%edx
f0101bec:	89 f0                	mov    %esi,%eax
f0101bee:	e8 94 ee ff ff       	call   f0100a87 <check_va2pa>
f0101bf3:	83 c4 10             	add    $0x10,%esp
f0101bf6:	83 f8 ff             	cmp    $0xffffffff,%eax
f0101bf9:	0f 85 e8 08 00 00    	jne    f01024e7 <mem_init+0x129d>
	assert(check_va2pa(kern_pgdir, PGSIZE) == page2pa(pp1));
f0101bff:	ba 00 10 00 00       	mov    $0x1000,%edx
f0101c04:	89 f0                	mov    %esi,%eax
f0101c06:	e8 7c ee ff ff       	call   f0100a87 <check_va2pa>
f0101c0b:	89 c2                	mov    %eax,%edx
f0101c0d:	89 f8                	mov    %edi,%eax
f0101c0f:	2b 05 90 7e 21 f0    	sub    0xf0217e90,%eax
f0101c15:	c1 f8 03             	sar    $0x3,%eax
f0101c18:	c1 e0 0c             	shl    $0xc,%eax
f0101c1b:	39 c2                	cmp    %eax,%edx
f0101c1d:	0f 85 dd 08 00 00    	jne    f0102500 <mem_init+0x12b6>
	assert(pp1->pp_ref == 1);
f0101c23:	66 83 7f 04 01       	cmpw   $0x1,0x4(%edi)
f0101c28:	0f 85 eb 08 00 00    	jne    f0102519 <mem_init+0x12cf>
	assert(pp2->pp_ref == 0);
f0101c2e:	66 83 7b 04 00       	cmpw   $0x0,0x4(%ebx)
f0101c33:	0f 85 f9 08 00 00    	jne    f0102532 <mem_init+0x12e8>

	// test re-inserting pp1 at PGSIZE
	assert(page_insert(kern_pgdir, pp1, (void*) PGSIZE, 0) == 0);
f0101c39:	6a 00                	push   $0x0
f0101c3b:	68 00 10 00 00       	push   $0x1000
f0101c40:	57                   	push   %edi
f0101c41:	56                   	push   %esi
f0101c42:	e8 12 f5 ff ff       	call   f0101159 <page_insert>
f0101c47:	83 c4 10             	add    $0x10,%esp
f0101c4a:	85 c0                	test   %eax,%eax
f0101c4c:	0f 85 f9 08 00 00    	jne    f010254b <mem_init+0x1301>
	assert(pp1->pp_ref);
f0101c52:	66 83 7f 04 00       	cmpw   $0x0,0x4(%edi)
f0101c57:	0f 84 07 09 00 00    	je     f0102564 <mem_init+0x131a>
	assert(pp1->pp_link == NULL);
f0101c5d:	83 3f 00             	cmpl   $0x0,(%edi)
f0101c60:	0f 85 17 09 00 00    	jne    f010257d <mem_init+0x1333>

	// unmapping pp1 at PGSIZE should free it
	page_remove(kern_pgdir, (void*) PGSIZE);
f0101c66:	83 ec 08             	sub    $0x8,%esp
f0101c69:	68 00 10 00 00       	push   $0x1000
f0101c6e:	ff 35 8c 7e 21 f0    	pushl  0xf0217e8c
f0101c74:	e8 96 f4 ff ff       	call   f010110f <page_remove>
	assert(check_va2pa(kern_pgdir, 0x0) == ~0);
f0101c79:	8b 35 8c 7e 21 f0    	mov    0xf0217e8c,%esi
f0101c7f:	ba 00 00 00 00       	mov    $0x0,%edx
f0101c84:	89 f0                	mov    %esi,%eax
f0101c86:	e8 fc ed ff ff       	call   f0100a87 <check_va2pa>
f0101c8b:	83 c4 10             	add    $0x10,%esp
f0101c8e:	83 f8 ff             	cmp    $0xffffffff,%eax
f0101c91:	0f 85 ff 08 00 00    	jne    f0102596 <mem_init+0x134c>
	assert(check_va2pa(kern_pgdir, PGSIZE) == ~0);
f0101c97:	ba 00 10 00 00       	mov    $0x1000,%edx
f0101c9c:	89 f0                	mov    %esi,%eax
f0101c9e:	e8 e4 ed ff ff       	call   f0100a87 <check_va2pa>
f0101ca3:	83 f8 ff             	cmp    $0xffffffff,%eax
f0101ca6:	0f 85 03 09 00 00    	jne    f01025af <mem_init+0x1365>
	assert(pp1->pp_ref == 0);
f0101cac:	66 83 7f 04 00       	cmpw   $0x0,0x4(%edi)
f0101cb1:	0f 85 11 09 00 00    	jne    f01025c8 <mem_init+0x137e>
	assert(pp2->pp_ref == 0);
f0101cb7:	66 83 7b 04 00       	cmpw   $0x0,0x4(%ebx)
f0101cbc:	0f 85 1f 09 00 00    	jne    f01025e1 <mem_init+0x1397>

	// so it should be returned by page_alloc
	assert((pp = page_alloc(0)) && pp == pp1);
f0101cc2:	83 ec 0c             	sub    $0xc,%esp
f0101cc5:	6a 00                	push   $0x0
f0101cc7:	e8 c7 f1 ff ff       	call   f0100e93 <page_alloc>
f0101ccc:	83 c4 10             	add    $0x10,%esp
f0101ccf:	39 c7                	cmp    %eax,%edi
f0101cd1:	0f 85 23 09 00 00    	jne    f01025fa <mem_init+0x13b0>
f0101cd7:	85 c0                	test   %eax,%eax
f0101cd9:	0f 84 1b 09 00 00    	je     f01025fa <mem_init+0x13b0>

	// should be no free memory
	assert(!page_alloc(0));
f0101cdf:	83 ec 0c             	sub    $0xc,%esp
f0101ce2:	6a 00                	push   $0x0
f0101ce4:	e8 aa f1 ff ff       	call   f0100e93 <page_alloc>
f0101ce9:	83 c4 10             	add    $0x10,%esp
f0101cec:	85 c0                	test   %eax,%eax
f0101cee:	0f 85 1f 09 00 00    	jne    f0102613 <mem_init+0x13c9>

	// forcibly take pp0 back
	assert(PTE_ADDR(kern_pgdir[0]) == page2pa(pp0));
f0101cf4:	8b 0d 8c 7e 21 f0    	mov    0xf0217e8c,%ecx
f0101cfa:	8b 11                	mov    (%ecx),%edx
f0101cfc:	81 e2 00 f0 ff ff    	and    $0xfffff000,%edx
f0101d02:	8b 45 d4             	mov    -0x2c(%ebp),%eax
f0101d05:	2b 05 90 7e 21 f0    	sub    0xf0217e90,%eax
f0101d0b:	c1 f8 03             	sar    $0x3,%eax
f0101d0e:	c1 e0 0c             	shl    $0xc,%eax
f0101d11:	39 c2                	cmp    %eax,%edx
f0101d13:	0f 85 13 09 00 00    	jne    f010262c <mem_init+0x13e2>
	kern_pgdir[0] = 0;
f0101d19:	c7 01 00 00 00 00    	movl   $0x0,(%ecx)
	assert(pp0->pp_ref == 1);
f0101d1f:	8b 45 d4             	mov    -0x2c(%ebp),%eax
f0101d22:	66 83 78 04 01       	cmpw   $0x1,0x4(%eax)
f0101d27:	0f 85 18 09 00 00    	jne    f0102645 <mem_init+0x13fb>
	pp0->pp_ref = 0;
f0101d2d:	8b 45 d4             	mov    -0x2c(%ebp),%eax
f0101d30:	66 c7 40 04 00 00    	movw   $0x0,0x4(%eax)

	// check pointer arithmetic in pgdir_walk
	page_free(pp0);
f0101d36:	83 ec 0c             	sub    $0xc,%esp
f0101d39:	50                   	push   %eax
f0101d3a:	e8 cd f1 ff ff       	call   f0100f0c <page_free>
	va = (void*)(PGSIZE * NPDENTRIES + PGSIZE);
	ptep = pgdir_walk(kern_pgdir, va, 1);
f0101d3f:	83 c4 0c             	add    $0xc,%esp
f0101d42:	6a 01                	push   $0x1
f0101d44:	68 00 10 40 00       	push   $0x401000
f0101d49:	ff 35 8c 7e 21 f0    	pushl  0xf0217e8c
f0101d4f:	e8 24 f2 ff ff       	call   f0100f78 <pgdir_walk>
f0101d54:	89 45 d0             	mov    %eax,-0x30(%ebp)
f0101d57:	89 45 e4             	mov    %eax,-0x1c(%ebp)
	ptep1 = (pte_t *) KADDR(PTE_ADDR(kern_pgdir[PDX(va)]));
f0101d5a:	8b 0d 8c 7e 21 f0    	mov    0xf0217e8c,%ecx
f0101d60:	8b 41 04             	mov    0x4(%ecx),%eax
f0101d63:	89 c6                	mov    %eax,%esi
f0101d65:	81 e6 00 f0 ff ff    	and    $0xfffff000,%esi
	if (PGNUM(pa) >= npages)
f0101d6b:	8b 15 88 7e 21 f0    	mov    0xf0217e88,%edx
f0101d71:	c1 e8 0c             	shr    $0xc,%eax
f0101d74:	83 c4 10             	add    $0x10,%esp
f0101d77:	39 d0                	cmp    %edx,%eax
f0101d79:	0f 83 df 08 00 00    	jae    f010265e <mem_init+0x1414>
	assert(ptep == ptep1 + PTX(va));
f0101d7f:	81 ee fc ff ff 0f    	sub    $0xffffffc,%esi
f0101d85:	39 75 d0             	cmp    %esi,-0x30(%ebp)
f0101d88:	0f 85 e5 08 00 00    	jne    f0102673 <mem_init+0x1429>
	kern_pgdir[PDX(va)] = 0;
f0101d8e:	c7 41 04 00 00 00 00 	movl   $0x0,0x4(%ecx)
	pp0->pp_ref = 0;
f0101d95:	8b 45 d4             	mov    -0x2c(%ebp),%eax
f0101d98:	66 c7 40 04 00 00    	movw   $0x0,0x4(%eax)
	return (pp - pages) << PGSHIFT;
f0101d9e:	2b 05 90 7e 21 f0    	sub    0xf0217e90,%eax
f0101da4:	c1 f8 03             	sar    $0x3,%eax
f0101da7:	89 c1                	mov    %eax,%ecx
f0101da9:	c1 e1 0c             	shl    $0xc,%ecx
	if (PGNUM(pa) >= npages)
f0101dac:	25 ff ff 0f 00       	and    $0xfffff,%eax
f0101db1:	39 c2                	cmp    %eax,%edx
f0101db3:	0f 86 d3 08 00 00    	jbe    f010268c <mem_init+0x1442>

	// check that new page tables get cleared
	memset(page2kva(pp0), 0xFF, PGSIZE);
f0101db9:	83 ec 04             	sub    $0x4,%esp
f0101dbc:	68 00 10 00 00       	push   $0x1000
f0101dc1:	68 ff 00 00 00       	push   $0xff
	return (void *)(pa + KERNBASE);
f0101dc6:	81 e9 00 00 00 10    	sub    $0x10000000,%ecx
f0101dcc:	51                   	push   %ecx
f0101dcd:	e8 18 3b 00 00       	call   f01058ea <memset>
	page_free(pp0);
f0101dd2:	8b 75 d4             	mov    -0x2c(%ebp),%esi
f0101dd5:	89 34 24             	mov    %esi,(%esp)
f0101dd8:	e8 2f f1 ff ff       	call   f0100f0c <page_free>
	pgdir_walk(kern_pgdir, 0x0, 1);
f0101ddd:	83 c4 0c             	add    $0xc,%esp
f0101de0:	6a 01                	push   $0x1
f0101de2:	6a 00                	push   $0x0
f0101de4:	ff 35 8c 7e 21 f0    	pushl  0xf0217e8c
f0101dea:	e8 89 f1 ff ff       	call   f0100f78 <pgdir_walk>
	return (pp - pages) << PGSHIFT;
f0101def:	89 f0                	mov    %esi,%eax
f0101df1:	2b 05 90 7e 21 f0    	sub    0xf0217e90,%eax
f0101df7:	c1 f8 03             	sar    $0x3,%eax
f0101dfa:	89 c2                	mov    %eax,%edx
f0101dfc:	c1 e2 0c             	shl    $0xc,%edx
	if (PGNUM(pa) >= npages)
f0101dff:	25 ff ff 0f 00       	and    $0xfffff,%eax
f0101e04:	83 c4 10             	add    $0x10,%esp
f0101e07:	3b 05 88 7e 21 f0    	cmp    0xf0217e88,%eax
f0101e0d:	0f 83 8b 08 00 00    	jae    f010269e <mem_init+0x1454>
	return (void *)(pa + KERNBASE);
f0101e13:	8d 82 00 00 00 f0    	lea    -0x10000000(%edx),%eax
	ptep = (pte_t *) page2kva(pp0);
f0101e19:	89 45 e4             	mov    %eax,-0x1c(%ebp)
f0101e1c:	81 ea 00 f0 ff 0f    	sub    $0xffff000,%edx
	for(i=0; i<NPTENTRIES; i++)
		assert((ptep[i] & PTE_P) == 0);
f0101e22:	f6 00 01             	testb  $0x1,(%eax)
f0101e25:	0f 85 85 08 00 00    	jne    f01026b0 <mem_init+0x1466>
f0101e2b:	83 c0 04             	add    $0x4,%eax
	for(i=0; i<NPTENTRIES; i++)
f0101e2e:	39 d0                	cmp    %edx,%eax
f0101e30:	75 f0                	jne    f0101e22 <mem_init+0xbd8>
	kern_pgdir[0] = 0;
f0101e32:	a1 8c 7e 21 f0       	mov    0xf0217e8c,%eax
f0101e37:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	pp0->pp_ref = 0;
f0101e3d:	8b 45 d4             	mov    -0x2c(%ebp),%eax
f0101e40:	66 c7 40 04 00 00    	movw   $0x0,0x4(%eax)

	// give free list back
	page_free_list = fl;
f0101e46:	8b 4d cc             	mov    -0x34(%ebp),%ecx
f0101e49:	89 0d 40 72 21 f0    	mov    %ecx,0xf0217240

	// free the pages we took
	page_free(pp0);
f0101e4f:	83 ec 0c             	sub    $0xc,%esp
f0101e52:	50                   	push   %eax
f0101e53:	e8 b4 f0 ff ff       	call   f0100f0c <page_free>
	page_free(pp1);
f0101e58:	89 3c 24             	mov    %edi,(%esp)
f0101e5b:	e8 ac f0 ff ff       	call   f0100f0c <page_free>
	page_free(pp2);
f0101e60:	89 1c 24             	mov    %ebx,(%esp)
f0101e63:	e8 a4 f0 ff ff       	call   f0100f0c <page_free>

	// test mmio_map_region
	mm1 = (uintptr_t) mmio_map_region(0, 4097);
f0101e68:	83 c4 08             	add    $0x8,%esp
f0101e6b:	68 01 10 00 00       	push   $0x1001
f0101e70:	6a 00                	push   $0x0
f0101e72:	e8 69 f3 ff ff       	call   f01011e0 <mmio_map_region>
f0101e77:	89 c3                	mov    %eax,%ebx
	mm2 = (uintptr_t) mmio_map_region(0, 4096);
f0101e79:	83 c4 08             	add    $0x8,%esp
f0101e7c:	68 00 10 00 00       	push   $0x1000
f0101e81:	6a 00                	push   $0x0
f0101e83:	e8 58 f3 ff ff       	call   f01011e0 <mmio_map_region>
f0101e88:	89 c6                	mov    %eax,%esi
	// check that they're in the right region
	assert(mm1 >= MMIOBASE && mm1 + 8192 < MMIOLIM);
f0101e8a:	8d 83 00 20 00 00    	lea    0x2000(%ebx),%eax
f0101e90:	83 c4 10             	add    $0x10,%esp
f0101e93:	81 fb ff ff 7f ef    	cmp    $0xef7fffff,%ebx
f0101e99:	0f 86 2a 08 00 00    	jbe    f01026c9 <mem_init+0x147f>
f0101e9f:	3d ff ff bf ef       	cmp    $0xefbfffff,%eax
f0101ea4:	0f 87 1f 08 00 00    	ja     f01026c9 <mem_init+0x147f>
	assert(mm2 >= MMIOBASE && mm2 + 8192 < MMIOLIM);
f0101eaa:	8d 96 00 20 00 00    	lea    0x2000(%esi),%edx
f0101eb0:	81 fa ff ff bf ef    	cmp    $0xefbfffff,%edx
f0101eb6:	0f 87 26 08 00 00    	ja     f01026e2 <mem_init+0x1498>
f0101ebc:	81 fe ff ff 7f ef    	cmp    $0xef7fffff,%esi
f0101ec2:	0f 86 1a 08 00 00    	jbe    f01026e2 <mem_init+0x1498>
	// check that they're page-aligned
	assert(mm1 % PGSIZE == 0 && mm2 % PGSIZE == 0);
f0101ec8:	89 da                	mov    %ebx,%edx
f0101eca:	09 f2                	or     %esi,%edx
f0101ecc:	f7 c2 ff 0f 00 00    	test   $0xfff,%edx
f0101ed2:	0f 85 23 08 00 00    	jne    f01026fb <mem_init+0x14b1>
	// check that they don't overlap
	assert(mm1 + 8192 <= mm2);
f0101ed8:	39 c6                	cmp    %eax,%esi
f0101eda:	0f 82 34 08 00 00    	jb     f0102714 <mem_init+0x14ca>
	// check page mappings
	assert(check_va2pa(kern_pgdir, mm1) == 0);
f0101ee0:	8b 3d 8c 7e 21 f0    	mov    0xf0217e8c,%edi
f0101ee6:	89 da                	mov    %ebx,%edx
f0101ee8:	89 f8                	mov    %edi,%eax
f0101eea:	e8 98 eb ff ff       	call   f0100a87 <check_va2pa>
f0101eef:	85 c0                	test   %eax,%eax
f0101ef1:	0f 85 36 08 00 00    	jne    f010272d <mem_init+0x14e3>
	assert(check_va2pa(kern_pgdir, mm1+PGSIZE) == PGSIZE);
f0101ef7:	8d 83 00 10 00 00    	lea    0x1000(%ebx),%eax
f0101efd:	89 45 d4             	mov    %eax,-0x2c(%ebp)
f0101f00:	89 c2                	mov    %eax,%edx
f0101f02:	89 f8                	mov    %edi,%eax
f0101f04:	e8 7e eb ff ff       	call   f0100a87 <check_va2pa>
f0101f09:	3d 00 10 00 00       	cmp    $0x1000,%eax
f0101f0e:	0f 85 32 08 00 00    	jne    f0102746 <mem_init+0x14fc>
	assert(check_va2pa(kern_pgdir, mm2) == 0);
f0101f14:	89 f2                	mov    %esi,%edx
f0101f16:	89 f8                	mov    %edi,%eax
f0101f18:	e8 6a eb ff ff       	call   f0100a87 <check_va2pa>
f0101f1d:	85 c0                	test   %eax,%eax
f0101f1f:	0f 85 3a 08 00 00    	jne    f010275f <mem_init+0x1515>
	assert(check_va2pa(kern_pgdir, mm2+PGSIZE) == ~0);
f0101f25:	8d 96 00 10 00 00    	lea    0x1000(%esi),%edx
f0101f2b:	89 f8                	mov    %edi,%eax
f0101f2d:	e8 55 eb ff ff       	call   f0100a87 <check_va2pa>
f0101f32:	83 f8 ff             	cmp    $0xffffffff,%eax
f0101f35:	0f 85 3d 08 00 00    	jne    f0102778 <mem_init+0x152e>
	// check permissions
	assert(*pgdir_walk(kern_pgdir, (void*) mm1, 0) & (PTE_W|PTE_PWT|PTE_PCD));
f0101f3b:	83 ec 04             	sub    $0x4,%esp
f0101f3e:	6a 00                	push   $0x0
f0101f40:	53                   	push   %ebx
f0101f41:	57                   	push   %edi
f0101f42:	e8 31 f0 ff ff       	call   f0100f78 <pgdir_walk>
f0101f47:	83 c4 10             	add    $0x10,%esp
f0101f4a:	f6 00 1a             	testb  $0x1a,(%eax)
f0101f4d:	0f 84 3e 08 00 00    	je     f0102791 <mem_init+0x1547>
	assert(!(*pgdir_walk(kern_pgdir, (void*) mm1, 0) & PTE_U));
f0101f53:	83 ec 04             	sub    $0x4,%esp
f0101f56:	6a 00                	push   $0x0
f0101f58:	53                   	push   %ebx
f0101f59:	ff 35 8c 7e 21 f0    	pushl  0xf0217e8c
f0101f5f:	e8 14 f0 ff ff       	call   f0100f78 <pgdir_walk>
f0101f64:	8b 00                	mov    (%eax),%eax
f0101f66:	83 c4 10             	add    $0x10,%esp
f0101f69:	83 e0 04             	and    $0x4,%eax
f0101f6c:	89 c7                	mov    %eax,%edi
f0101f6e:	0f 85 36 08 00 00    	jne    f01027aa <mem_init+0x1560>
	// clear the mappings
	*pgdir_walk(kern_pgdir, (void*) mm1, 0) = 0;
f0101f74:	83 ec 04             	sub    $0x4,%esp
f0101f77:	6a 00                	push   $0x0
f0101f79:	53                   	push   %ebx
f0101f7a:	ff 35 8c 7e 21 f0    	pushl  0xf0217e8c
f0101f80:	e8 f3 ef ff ff       	call   f0100f78 <pgdir_walk>
f0101f85:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	*pgdir_walk(kern_pgdir, (void*) mm1 + PGSIZE, 0) = 0;
f0101f8b:	83 c4 0c             	add    $0xc,%esp
f0101f8e:	6a 00                	push   $0x0
f0101f90:	ff 75 d4             	pushl  -0x2c(%ebp)
f0101f93:	ff 35 8c 7e 21 f0    	pushl  0xf0217e8c
f0101f99:	e8 da ef ff ff       	call   f0100f78 <pgdir_walk>
f0101f9e:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	*pgdir_walk(kern_pgdir, (void*) mm2, 0) = 0;
f0101fa4:	83 c4 0c             	add    $0xc,%esp
f0101fa7:	6a 00                	push   $0x0
f0101fa9:	56                   	push   %esi
f0101faa:	ff 35 8c 7e 21 f0    	pushl  0xf0217e8c
f0101fb0:	e8 c3 ef ff ff       	call   f0100f78 <pgdir_walk>
f0101fb5:	c7 00 00 00 00 00    	movl   $0x0,(%eax)

	cprintf("check_page() succeeded!\n");
f0101fbb:	c7 04 24 ee 76 10 f0 	movl   $0xf01076ee,(%esp)
f0101fc2:	e8 16 18 00 00       	call   f01037dd <cprintf>
    boot_map_region(kern_pgdir, UPAGES, PTSIZE, PADDR(pages), PTE_U|PTE_P);
f0101fc7:	a1 90 7e 21 f0       	mov    0xf0217e90,%eax
	if ((uint32_t)kva < KERNBASE)
f0101fcc:	83 c4 10             	add    $0x10,%esp
f0101fcf:	3d ff ff ff ef       	cmp    $0xefffffff,%eax
f0101fd4:	0f 86 e9 07 00 00    	jbe    f01027c3 <mem_init+0x1579>
f0101fda:	83 ec 08             	sub    $0x8,%esp
f0101fdd:	6a 05                	push   $0x5
	return (physaddr_t)kva - KERNBASE;
f0101fdf:	05 00 00 00 10       	add    $0x10000000,%eax
f0101fe4:	50                   	push   %eax
f0101fe5:	b9 00 00 40 00       	mov    $0x400000,%ecx
f0101fea:	ba 00 00 00 ef       	mov    $0xef000000,%edx
f0101fef:	a1 8c 7e 21 f0       	mov    0xf0217e8c,%eax
f0101ff4:	e8 12 f0 ff ff       	call   f010100b <boot_map_region>
    boot_map_region(kern_pgdir, UENVS, PTSIZE, PADDR(envs), PTE_U);
f0101ff9:	a1 48 72 21 f0       	mov    0xf0217248,%eax
	if ((uint32_t)kva < KERNBASE)
f0101ffe:	83 c4 10             	add    $0x10,%esp
f0102001:	3d ff ff ff ef       	cmp    $0xefffffff,%eax
f0102006:	0f 86 cc 07 00 00    	jbe    f01027d8 <mem_init+0x158e>
f010200c:	83 ec 08             	sub    $0x8,%esp
f010200f:	6a 04                	push   $0x4
	return (physaddr_t)kva - KERNBASE;
f0102011:	05 00 00 00 10       	add    $0x10000000,%eax
f0102016:	50                   	push   %eax
f0102017:	b9 00 00 40 00       	mov    $0x400000,%ecx
f010201c:	ba 00 00 c0 ee       	mov    $0xeec00000,%edx
f0102021:	a1 8c 7e 21 f0       	mov    0xf0217e8c,%eax
f0102026:	e8 e0 ef ff ff       	call   f010100b <boot_map_region>
	if ((uint32_t)kva < KERNBASE)
f010202b:	83 c4 10             	add    $0x10,%esp
f010202e:	b8 00 90 11 f0       	mov    $0xf0119000,%eax
f0102033:	3d ff ff ff ef       	cmp    $0xefffffff,%eax
f0102038:	0f 86 af 07 00 00    	jbe    f01027ed <mem_init+0x15a3>
    boot_map_region(kern_pgdir, KSTACKTOP-KSTKSIZE, KSTKSIZE, PADDR(bootstack), PTE_W|PTE_P);
f010203e:	83 ec 08             	sub    $0x8,%esp
f0102041:	6a 03                	push   $0x3
f0102043:	68 00 90 11 00       	push   $0x119000
f0102048:	b9 00 80 00 00       	mov    $0x8000,%ecx
f010204d:	ba 00 80 ff ef       	mov    $0xefff8000,%edx
f0102052:	a1 8c 7e 21 f0       	mov    0xf0217e8c,%eax
f0102057:	e8 af ef ff ff       	call   f010100b <boot_map_region>
	boot_map_region(kern_pgdir, KERNBASE, 0x100000000-KERNBASE, 0, PTE_W|PTE_P);
f010205c:	83 c4 08             	add    $0x8,%esp
f010205f:	6a 03                	push   $0x3
f0102061:	6a 00                	push   $0x0
f0102063:	b9 00 00 00 10       	mov    $0x10000000,%ecx
f0102068:	ba 00 00 00 f0       	mov    $0xf0000000,%edx
f010206d:	a1 8c 7e 21 f0       	mov    0xf0217e8c,%eax
f0102072:	e8 94 ef ff ff       	call   f010100b <boot_map_region>
f0102077:	c7 45 d0 00 90 21 f0 	movl   $0xf0219000,-0x30(%ebp)
f010207e:	83 c4 10             	add    $0x10,%esp
f0102081:	bb 00 90 21 f0       	mov    $0xf0219000,%ebx
f0102086:	be 00 80 ff ef       	mov    $0xefff8000,%esi
f010208b:	81 fb ff ff ff ef    	cmp    $0xefffffff,%ebx
f0102091:	0f 86 6b 07 00 00    	jbe    f0102802 <mem_init+0x15b8>
        boot_map_region(kern_pgdir,startStacki-KSTKSIZE,KSTKSIZE,PADDR(percpu_kstacks[CPU_i]),PTE_W|PTE_P);	//只映射KSTKSIZE大小为有效
f0102097:	83 ec 08             	sub    $0x8,%esp
f010209a:	6a 03                	push   $0x3
f010209c:	8d 83 00 00 00 10    	lea    0x10000000(%ebx),%eax
f01020a2:	50                   	push   %eax
f01020a3:	b9 00 80 00 00       	mov    $0x8000,%ecx
f01020a8:	89 f2                	mov    %esi,%edx
f01020aa:	a1 8c 7e 21 f0       	mov    0xf0217e8c,%eax
f01020af:	e8 57 ef ff ff       	call   f010100b <boot_map_region>
f01020b4:	81 c3 00 80 00 00    	add    $0x8000,%ebx
f01020ba:	81 ee 00 00 01 00    	sub    $0x10000,%esi
	for(;CPU_i< NCPU;++CPU_i){
f01020c0:	83 c4 10             	add    $0x10,%esp
f01020c3:	81 fb 00 90 25 f0    	cmp    $0xf0259000,%ebx
f01020c9:	75 c0                	jne    f010208b <mem_init+0xe41>
	pgdir = kern_pgdir;
f01020cb:	a1 8c 7e 21 f0       	mov    0xf0217e8c,%eax
f01020d0:	89 45 d4             	mov    %eax,-0x2c(%ebp)
	n = ROUNDUP(npages*sizeof(struct PageInfo), PGSIZE);
f01020d3:	a1 88 7e 21 f0       	mov    0xf0217e88,%eax
f01020d8:	89 45 c0             	mov    %eax,-0x40(%ebp)
f01020db:	8d 04 c5 ff 0f 00 00 	lea    0xfff(,%eax,8),%eax
f01020e2:	25 00 f0 ff ff       	and    $0xfffff000,%eax
f01020e7:	89 45 cc             	mov    %eax,-0x34(%ebp)
		assert(check_va2pa(pgdir, UPAGES + i) == PADDR(pages) + i);
f01020ea:	8b 35 90 7e 21 f0    	mov    0xf0217e90,%esi
f01020f0:	89 75 c8             	mov    %esi,-0x38(%ebp)
	return (physaddr_t)kva - KERNBASE;
f01020f3:	8d 86 00 00 00 10    	lea    0x10000000(%esi),%eax
f01020f9:	89 45 c4             	mov    %eax,-0x3c(%ebp)
	for (i = 0; i < n; i += PGSIZE)
f01020fc:	89 fb                	mov    %edi,%ebx
f01020fe:	e9 2f 07 00 00       	jmp    f0102832 <mem_init+0x15e8>
	assert(nfree == 0);
f0102103:	68 05 76 10 f0       	push   $0xf0107605
f0102108:	68 47 74 10 f0       	push   $0xf0107447
f010210d:	68 69 03 00 00       	push   $0x369
f0102112:	68 21 74 10 f0       	push   $0xf0107421
f0102117:	e8 24 df ff ff       	call   f0100040 <_panic>
	assert((pp0 = page_alloc(0)));
f010211c:	68 13 75 10 f0       	push   $0xf0107513
f0102121:	68 47 74 10 f0       	push   $0xf0107447
f0102126:	68 cf 03 00 00       	push   $0x3cf
f010212b:	68 21 74 10 f0       	push   $0xf0107421
f0102130:	e8 0b df ff ff       	call   f0100040 <_panic>
	assert((pp1 = page_alloc(0)));
f0102135:	68 29 75 10 f0       	push   $0xf0107529
f010213a:	68 47 74 10 f0       	push   $0xf0107447
f010213f:	68 d0 03 00 00       	push   $0x3d0
f0102144:	68 21 74 10 f0       	push   $0xf0107421
f0102149:	e8 f2 de ff ff       	call   f0100040 <_panic>
	assert((pp2 = page_alloc(0)));
f010214e:	68 3f 75 10 f0       	push   $0xf010753f
f0102153:	68 47 74 10 f0       	push   $0xf0107447
f0102158:	68 d1 03 00 00       	push   $0x3d1
f010215d:	68 21 74 10 f0       	push   $0xf0107421
f0102162:	e8 d9 de ff ff       	call   f0100040 <_panic>
	assert(pp1 && pp1 != pp0);
f0102167:	68 55 75 10 f0       	push   $0xf0107555
f010216c:	68 47 74 10 f0       	push   $0xf0107447
f0102171:	68 d4 03 00 00       	push   $0x3d4
f0102176:	68 21 74 10 f0       	push   $0xf0107421
f010217b:	e8 c0 de ff ff       	call   f0100040 <_panic>
	assert(pp2 && pp2 != pp1 && pp2 != pp0);
f0102180:	68 44 6c 10 f0       	push   $0xf0106c44
f0102185:	68 47 74 10 f0       	push   $0xf0107447
f010218a:	68 d5 03 00 00       	push   $0x3d5
f010218f:	68 21 74 10 f0       	push   $0xf0107421
f0102194:	e8 a7 de ff ff       	call   f0100040 <_panic>
	assert(!page_alloc(0));
f0102199:	68 be 75 10 f0       	push   $0xf01075be
f010219e:	68 47 74 10 f0       	push   $0xf0107447
f01021a3:	68 dc 03 00 00       	push   $0x3dc
f01021a8:	68 21 74 10 f0       	push   $0xf0107421
f01021ad:	e8 8e de ff ff       	call   f0100040 <_panic>
	assert(page_lookup(kern_pgdir, (void *) 0x0, &ptep) == NULL);
f01021b2:	68 84 6c 10 f0       	push   $0xf0106c84
f01021b7:	68 47 74 10 f0       	push   $0xf0107447
f01021bc:	68 df 03 00 00       	push   $0x3df
f01021c1:	68 21 74 10 f0       	push   $0xf0107421
f01021c6:	e8 75 de ff ff       	call   f0100040 <_panic>
	assert(page_insert(kern_pgdir, pp1, 0x0, PTE_W) < 0);
f01021cb:	68 bc 6c 10 f0       	push   $0xf0106cbc
f01021d0:	68 47 74 10 f0       	push   $0xf0107447
f01021d5:	68 e2 03 00 00       	push   $0x3e2
f01021da:	68 21 74 10 f0       	push   $0xf0107421
f01021df:	e8 5c de ff ff       	call   f0100040 <_panic>
	assert(page_insert(kern_pgdir, pp1, 0x0, PTE_W) == 0);
f01021e4:	68 ec 6c 10 f0       	push   $0xf0106cec
f01021e9:	68 47 74 10 f0       	push   $0xf0107447
f01021ee:	68 e6 03 00 00       	push   $0x3e6
f01021f3:	68 21 74 10 f0       	push   $0xf0107421
f01021f8:	e8 43 de ff ff       	call   f0100040 <_panic>
	assert(PTE_ADDR(kern_pgdir[0]) == page2pa(pp0));
f01021fd:	68 1c 6d 10 f0       	push   $0xf0106d1c
f0102202:	68 47 74 10 f0       	push   $0xf0107447
f0102207:	68 e7 03 00 00       	push   $0x3e7
f010220c:	68 21 74 10 f0       	push   $0xf0107421
f0102211:	e8 2a de ff ff       	call   f0100040 <_panic>
	assert(check_va2pa(kern_pgdir, 0x0) == page2pa(pp1));
f0102216:	68 44 6d 10 f0       	push   $0xf0106d44
f010221b:	68 47 74 10 f0       	push   $0xf0107447
f0102220:	68 e8 03 00 00       	push   $0x3e8
f0102225:	68 21 74 10 f0       	push   $0xf0107421
f010222a:	e8 11 de ff ff       	call   f0100040 <_panic>
	assert(pp1->pp_ref == 1);
f010222f:	68 10 76 10 f0       	push   $0xf0107610
f0102234:	68 47 74 10 f0       	push   $0xf0107447
f0102239:	68 e9 03 00 00       	push   $0x3e9
f010223e:	68 21 74 10 f0       	push   $0xf0107421
f0102243:	e8 f8 dd ff ff       	call   f0100040 <_panic>
	assert(pp0->pp_ref == 1);
f0102248:	68 21 76 10 f0       	push   $0xf0107621
f010224d:	68 47 74 10 f0       	push   $0xf0107447
f0102252:	68 ea 03 00 00       	push   $0x3ea
f0102257:	68 21 74 10 f0       	push   $0xf0107421
f010225c:	e8 df dd ff ff       	call   f0100040 <_panic>
	assert(page_insert(kern_pgdir, pp2, (void*) PGSIZE, PTE_W) == 0);
f0102261:	68 74 6d 10 f0       	push   $0xf0106d74
f0102266:	68 47 74 10 f0       	push   $0xf0107447
f010226b:	68 ed 03 00 00       	push   $0x3ed
f0102270:	68 21 74 10 f0       	push   $0xf0107421
f0102275:	e8 c6 dd ff ff       	call   f0100040 <_panic>
	assert(check_va2pa(kern_pgdir, PGSIZE) == page2pa(pp2));
f010227a:	68 b0 6d 10 f0       	push   $0xf0106db0
f010227f:	68 47 74 10 f0       	push   $0xf0107447
f0102284:	68 ee 03 00 00       	push   $0x3ee
f0102289:	68 21 74 10 f0       	push   $0xf0107421
f010228e:	e8 ad dd ff ff       	call   f0100040 <_panic>
	assert(pp2->pp_ref == 1);
f0102293:	68 32 76 10 f0       	push   $0xf0107632
f0102298:	68 47 74 10 f0       	push   $0xf0107447
f010229d:	68 ef 03 00 00       	push   $0x3ef
f01022a2:	68 21 74 10 f0       	push   $0xf0107421
f01022a7:	e8 94 dd ff ff       	call   f0100040 <_panic>
	assert(!page_alloc(0));
f01022ac:	68 be 75 10 f0       	push   $0xf01075be
f01022b1:	68 47 74 10 f0       	push   $0xf0107447
f01022b6:	68 f2 03 00 00       	push   $0x3f2
f01022bb:	68 21 74 10 f0       	push   $0xf0107421
f01022c0:	e8 7b dd ff ff       	call   f0100040 <_panic>
	assert(page_insert(kern_pgdir, pp2, (void*) PGSIZE, PTE_W) == 0);
f01022c5:	68 74 6d 10 f0       	push   $0xf0106d74
f01022ca:	68 47 74 10 f0       	push   $0xf0107447
f01022cf:	68 f5 03 00 00       	push   $0x3f5
f01022d4:	68 21 74 10 f0       	push   $0xf0107421
f01022d9:	e8 62 dd ff ff       	call   f0100040 <_panic>
	assert(check_va2pa(kern_pgdir, PGSIZE) == page2pa(pp2));
f01022de:	68 b0 6d 10 f0       	push   $0xf0106db0
f01022e3:	68 47 74 10 f0       	push   $0xf0107447
f01022e8:	68 f6 03 00 00       	push   $0x3f6
f01022ed:	68 21 74 10 f0       	push   $0xf0107421
f01022f2:	e8 49 dd ff ff       	call   f0100040 <_panic>
	assert(pp2->pp_ref == 1);
f01022f7:	68 32 76 10 f0       	push   $0xf0107632
f01022fc:	68 47 74 10 f0       	push   $0xf0107447
f0102301:	68 f7 03 00 00       	push   $0x3f7
f0102306:	68 21 74 10 f0       	push   $0xf0107421
f010230b:	e8 30 dd ff ff       	call   f0100040 <_panic>
	assert(!page_alloc(0));
f0102310:	68 be 75 10 f0       	push   $0xf01075be
f0102315:	68 47 74 10 f0       	push   $0xf0107447
f010231a:	68 fb 03 00 00       	push   $0x3fb
f010231f:	68 21 74 10 f0       	push   $0xf0107421
f0102324:	e8 17 dd ff ff       	call   f0100040 <_panic>
		_panic(file, line, "KADDR called with invalid pa %08lx", pa);
f0102329:	52                   	push   %edx
f010232a:	68 a4 65 10 f0       	push   $0xf01065a4
f010232f:	68 fe 03 00 00       	push   $0x3fe
f0102334:	68 21 74 10 f0       	push   $0xf0107421
f0102339:	e8 02 dd ff ff       	call   f0100040 <_panic>
	assert(pgdir_walk(kern_pgdir, (void*)PGSIZE, 0) == ptep+PTX(PGSIZE));
f010233e:	68 e0 6d 10 f0       	push   $0xf0106de0
f0102343:	68 47 74 10 f0       	push   $0xf0107447
f0102348:	68 ff 03 00 00       	push   $0x3ff
f010234d:	68 21 74 10 f0       	push   $0xf0107421
f0102352:	e8 e9 dc ff ff       	call   f0100040 <_panic>
	assert(page_insert(kern_pgdir, pp2, (void*) PGSIZE, PTE_W|PTE_U) == 0);
f0102357:	68 20 6e 10 f0       	push   $0xf0106e20
f010235c:	68 47 74 10 f0       	push   $0xf0107447
f0102361:	68 02 04 00 00       	push   $0x402
f0102366:	68 21 74 10 f0       	push   $0xf0107421
f010236b:	e8 d0 dc ff ff       	call   f0100040 <_panic>
	assert(check_va2pa(kern_pgdir, PGSIZE) == page2pa(pp2));
f0102370:	68 b0 6d 10 f0       	push   $0xf0106db0
f0102375:	68 47 74 10 f0       	push   $0xf0107447
f010237a:	68 03 04 00 00       	push   $0x403
f010237f:	68 21 74 10 f0       	push   $0xf0107421
f0102384:	e8 b7 dc ff ff       	call   f0100040 <_panic>
	assert(pp2->pp_ref == 1);
f0102389:	68 32 76 10 f0       	push   $0xf0107632
f010238e:	68 47 74 10 f0       	push   $0xf0107447
f0102393:	68 04 04 00 00       	push   $0x404
f0102398:	68 21 74 10 f0       	push   $0xf0107421
f010239d:	e8 9e dc ff ff       	call   f0100040 <_panic>
	assert(*pgdir_walk(kern_pgdir, (void*) PGSIZE, 0) & PTE_U);
f01023a2:	68 60 6e 10 f0       	push   $0xf0106e60
f01023a7:	68 47 74 10 f0       	push   $0xf0107447
f01023ac:	68 05 04 00 00       	push   $0x405
f01023b1:	68 21 74 10 f0       	push   $0xf0107421
f01023b6:	e8 85 dc ff ff       	call   f0100040 <_panic>
	assert(kern_pgdir[0] & PTE_U);
f01023bb:	68 43 76 10 f0       	push   $0xf0107643
f01023c0:	68 47 74 10 f0       	push   $0xf0107447
f01023c5:	68 06 04 00 00       	push   $0x406
f01023ca:	68 21 74 10 f0       	push   $0xf0107421
f01023cf:	e8 6c dc ff ff       	call   f0100040 <_panic>
	assert(page_insert(kern_pgdir, pp2, (void*) PGSIZE, PTE_W) == 0);
f01023d4:	68 74 6d 10 f0       	push   $0xf0106d74
f01023d9:	68 47 74 10 f0       	push   $0xf0107447
f01023de:	68 09 04 00 00       	push   $0x409
f01023e3:	68 21 74 10 f0       	push   $0xf0107421
f01023e8:	e8 53 dc ff ff       	call   f0100040 <_panic>
	assert(*pgdir_walk(kern_pgdir, (void*) PGSIZE, 0) & PTE_W);
f01023ed:	68 94 6e 10 f0       	push   $0xf0106e94
f01023f2:	68 47 74 10 f0       	push   $0xf0107447
f01023f7:	68 0a 04 00 00       	push   $0x40a
f01023fc:	68 21 74 10 f0       	push   $0xf0107421
f0102401:	e8 3a dc ff ff       	call   f0100040 <_panic>
	assert(!(*pgdir_walk(kern_pgdir, (void*) PGSIZE, 0) & PTE_U));
f0102406:	68 c8 6e 10 f0       	push   $0xf0106ec8
f010240b:	68 47 74 10 f0       	push   $0xf0107447
f0102410:	68 0b 04 00 00       	push   $0x40b
f0102415:	68 21 74 10 f0       	push   $0xf0107421
f010241a:	e8 21 dc ff ff       	call   f0100040 <_panic>
	assert(page_insert(kern_pgdir, pp0, (void*) PTSIZE, PTE_W) < 0);
f010241f:	68 00 6f 10 f0       	push   $0xf0106f00
f0102424:	68 47 74 10 f0       	push   $0xf0107447
f0102429:	68 0e 04 00 00       	push   $0x40e
f010242e:	68 21 74 10 f0       	push   $0xf0107421
f0102433:	e8 08 dc ff ff       	call   f0100040 <_panic>
	assert(page_insert(kern_pgdir, pp1, (void*) PGSIZE, PTE_W) == 0);
f0102438:	68 38 6f 10 f0       	push   $0xf0106f38
f010243d:	68 47 74 10 f0       	push   $0xf0107447
f0102442:	68 11 04 00 00       	push   $0x411
f0102447:	68 21 74 10 f0       	push   $0xf0107421
f010244c:	e8 ef db ff ff       	call   f0100040 <_panic>
	assert(!(*pgdir_walk(kern_pgdir, (void*) PGSIZE, 0) & PTE_U));
f0102451:	68 c8 6e 10 f0       	push   $0xf0106ec8
f0102456:	68 47 74 10 f0       	push   $0xf0107447
f010245b:	68 12 04 00 00       	push   $0x412
f0102460:	68 21 74 10 f0       	push   $0xf0107421
f0102465:	e8 d6 db ff ff       	call   f0100040 <_panic>
	assert(check_va2pa(kern_pgdir, 0) == page2pa(pp1));
f010246a:	68 74 6f 10 f0       	push   $0xf0106f74
f010246f:	68 47 74 10 f0       	push   $0xf0107447
f0102474:	68 15 04 00 00       	push   $0x415
f0102479:	68 21 74 10 f0       	push   $0xf0107421
f010247e:	e8 bd db ff ff       	call   f0100040 <_panic>
	assert(check_va2pa(kern_pgdir, PGSIZE) == page2pa(pp1));
f0102483:	68 a0 6f 10 f0       	push   $0xf0106fa0
f0102488:	68 47 74 10 f0       	push   $0xf0107447
f010248d:	68 16 04 00 00       	push   $0x416
f0102492:	68 21 74 10 f0       	push   $0xf0107421
f0102497:	e8 a4 db ff ff       	call   f0100040 <_panic>
	assert(pp1->pp_ref == 2);
f010249c:	68 59 76 10 f0       	push   $0xf0107659
f01024a1:	68 47 74 10 f0       	push   $0xf0107447
f01024a6:	68 18 04 00 00       	push   $0x418
f01024ab:	68 21 74 10 f0       	push   $0xf0107421
f01024b0:	e8 8b db ff ff       	call   f0100040 <_panic>
	assert(pp2->pp_ref == 0);
f01024b5:	68 6a 76 10 f0       	push   $0xf010766a
f01024ba:	68 47 74 10 f0       	push   $0xf0107447
f01024bf:	68 19 04 00 00       	push   $0x419
f01024c4:	68 21 74 10 f0       	push   $0xf0107421
f01024c9:	e8 72 db ff ff       	call   f0100040 <_panic>
	assert((pp = page_alloc(0)) && pp == pp2);
f01024ce:	68 d0 6f 10 f0       	push   $0xf0106fd0
f01024d3:	68 47 74 10 f0       	push   $0xf0107447
f01024d8:	68 1c 04 00 00       	push   $0x41c
f01024dd:	68 21 74 10 f0       	push   $0xf0107421
f01024e2:	e8 59 db ff ff       	call   f0100040 <_panic>
	assert(check_va2pa(kern_pgdir, 0x0) == ~0);
f01024e7:	68 f4 6f 10 f0       	push   $0xf0106ff4
f01024ec:	68 47 74 10 f0       	push   $0xf0107447
f01024f1:	68 20 04 00 00       	push   $0x420
f01024f6:	68 21 74 10 f0       	push   $0xf0107421
f01024fb:	e8 40 db ff ff       	call   f0100040 <_panic>
	assert(check_va2pa(kern_pgdir, PGSIZE) == page2pa(pp1));
f0102500:	68 a0 6f 10 f0       	push   $0xf0106fa0
f0102505:	68 47 74 10 f0       	push   $0xf0107447
f010250a:	68 21 04 00 00       	push   $0x421
f010250f:	68 21 74 10 f0       	push   $0xf0107421
f0102514:	e8 27 db ff ff       	call   f0100040 <_panic>
	assert(pp1->pp_ref == 1);
f0102519:	68 10 76 10 f0       	push   $0xf0107610
f010251e:	68 47 74 10 f0       	push   $0xf0107447
f0102523:	68 22 04 00 00       	push   $0x422
f0102528:	68 21 74 10 f0       	push   $0xf0107421
f010252d:	e8 0e db ff ff       	call   f0100040 <_panic>
	assert(pp2->pp_ref == 0);
f0102532:	68 6a 76 10 f0       	push   $0xf010766a
f0102537:	68 47 74 10 f0       	push   $0xf0107447
f010253c:	68 23 04 00 00       	push   $0x423
f0102541:	68 21 74 10 f0       	push   $0xf0107421
f0102546:	e8 f5 da ff ff       	call   f0100040 <_panic>
	assert(page_insert(kern_pgdir, pp1, (void*) PGSIZE, 0) == 0);
f010254b:	68 18 70 10 f0       	push   $0xf0107018
f0102550:	68 47 74 10 f0       	push   $0xf0107447
f0102555:	68 26 04 00 00       	push   $0x426
f010255a:	68 21 74 10 f0       	push   $0xf0107421
f010255f:	e8 dc da ff ff       	call   f0100040 <_panic>
	assert(pp1->pp_ref);
f0102564:	68 7b 76 10 f0       	push   $0xf010767b
f0102569:	68 47 74 10 f0       	push   $0xf0107447
f010256e:	68 27 04 00 00       	push   $0x427
f0102573:	68 21 74 10 f0       	push   $0xf0107421
f0102578:	e8 c3 da ff ff       	call   f0100040 <_panic>
	assert(pp1->pp_link == NULL);
f010257d:	68 87 76 10 f0       	push   $0xf0107687
f0102582:	68 47 74 10 f0       	push   $0xf0107447
f0102587:	68 28 04 00 00       	push   $0x428
f010258c:	68 21 74 10 f0       	push   $0xf0107421
f0102591:	e8 aa da ff ff       	call   f0100040 <_panic>
	assert(check_va2pa(kern_pgdir, 0x0) == ~0);
f0102596:	68 f4 6f 10 f0       	push   $0xf0106ff4
f010259b:	68 47 74 10 f0       	push   $0xf0107447
f01025a0:	68 2c 04 00 00       	push   $0x42c
f01025a5:	68 21 74 10 f0       	push   $0xf0107421
f01025aa:	e8 91 da ff ff       	call   f0100040 <_panic>
	assert(check_va2pa(kern_pgdir, PGSIZE) == ~0);
f01025af:	68 50 70 10 f0       	push   $0xf0107050
f01025b4:	68 47 74 10 f0       	push   $0xf0107447
f01025b9:	68 2d 04 00 00       	push   $0x42d
f01025be:	68 21 74 10 f0       	push   $0xf0107421
f01025c3:	e8 78 da ff ff       	call   f0100040 <_panic>
	assert(pp1->pp_ref == 0);
f01025c8:	68 9c 76 10 f0       	push   $0xf010769c
f01025cd:	68 47 74 10 f0       	push   $0xf0107447
f01025d2:	68 2e 04 00 00       	push   $0x42e
f01025d7:	68 21 74 10 f0       	push   $0xf0107421
f01025dc:	e8 5f da ff ff       	call   f0100040 <_panic>
	assert(pp2->pp_ref == 0);
f01025e1:	68 6a 76 10 f0       	push   $0xf010766a
f01025e6:	68 47 74 10 f0       	push   $0xf0107447
f01025eb:	68 2f 04 00 00       	push   $0x42f
f01025f0:	68 21 74 10 f0       	push   $0xf0107421
f01025f5:	e8 46 da ff ff       	call   f0100040 <_panic>
	assert((pp = page_alloc(0)) && pp == pp1);
f01025fa:	68 78 70 10 f0       	push   $0xf0107078
f01025ff:	68 47 74 10 f0       	push   $0xf0107447
f0102604:	68 32 04 00 00       	push   $0x432
f0102609:	68 21 74 10 f0       	push   $0xf0107421
f010260e:	e8 2d da ff ff       	call   f0100040 <_panic>
	assert(!page_alloc(0));
f0102613:	68 be 75 10 f0       	push   $0xf01075be
f0102618:	68 47 74 10 f0       	push   $0xf0107447
f010261d:	68 35 04 00 00       	push   $0x435
f0102622:	68 21 74 10 f0       	push   $0xf0107421
f0102627:	e8 14 da ff ff       	call   f0100040 <_panic>
	assert(PTE_ADDR(kern_pgdir[0]) == page2pa(pp0));
f010262c:	68 1c 6d 10 f0       	push   $0xf0106d1c
f0102631:	68 47 74 10 f0       	push   $0xf0107447
f0102636:	68 38 04 00 00       	push   $0x438
f010263b:	68 21 74 10 f0       	push   $0xf0107421
f0102640:	e8 fb d9 ff ff       	call   f0100040 <_panic>
	assert(pp0->pp_ref == 1);
f0102645:	68 21 76 10 f0       	push   $0xf0107621
f010264a:	68 47 74 10 f0       	push   $0xf0107447
f010264f:	68 3a 04 00 00       	push   $0x43a
f0102654:	68 21 74 10 f0       	push   $0xf0107421
f0102659:	e8 e2 d9 ff ff       	call   f0100040 <_panic>
f010265e:	56                   	push   %esi
f010265f:	68 a4 65 10 f0       	push   $0xf01065a4
f0102664:	68 41 04 00 00       	push   $0x441
f0102669:	68 21 74 10 f0       	push   $0xf0107421
f010266e:	e8 cd d9 ff ff       	call   f0100040 <_panic>
	assert(ptep == ptep1 + PTX(va));
f0102673:	68 ad 76 10 f0       	push   $0xf01076ad
f0102678:	68 47 74 10 f0       	push   $0xf0107447
f010267d:	68 42 04 00 00       	push   $0x442
f0102682:	68 21 74 10 f0       	push   $0xf0107421
f0102687:	e8 b4 d9 ff ff       	call   f0100040 <_panic>
f010268c:	51                   	push   %ecx
f010268d:	68 a4 65 10 f0       	push   $0xf01065a4
f0102692:	6a 58                	push   $0x58
f0102694:	68 2d 74 10 f0       	push   $0xf010742d
f0102699:	e8 a2 d9 ff ff       	call   f0100040 <_panic>
f010269e:	52                   	push   %edx
f010269f:	68 a4 65 10 f0       	push   $0xf01065a4
f01026a4:	6a 58                	push   $0x58
f01026a6:	68 2d 74 10 f0       	push   $0xf010742d
f01026ab:	e8 90 d9 ff ff       	call   f0100040 <_panic>
		assert((ptep[i] & PTE_P) == 0);
f01026b0:	68 c5 76 10 f0       	push   $0xf01076c5
f01026b5:	68 47 74 10 f0       	push   $0xf0107447
f01026ba:	68 4c 04 00 00       	push   $0x44c
f01026bf:	68 21 74 10 f0       	push   $0xf0107421
f01026c4:	e8 77 d9 ff ff       	call   f0100040 <_panic>
	assert(mm1 >= MMIOBASE && mm1 + 8192 < MMIOLIM);
f01026c9:	68 9c 70 10 f0       	push   $0xf010709c
f01026ce:	68 47 74 10 f0       	push   $0xf0107447
f01026d3:	68 5c 04 00 00       	push   $0x45c
f01026d8:	68 21 74 10 f0       	push   $0xf0107421
f01026dd:	e8 5e d9 ff ff       	call   f0100040 <_panic>
	assert(mm2 >= MMIOBASE && mm2 + 8192 < MMIOLIM);
f01026e2:	68 c4 70 10 f0       	push   $0xf01070c4
f01026e7:	68 47 74 10 f0       	push   $0xf0107447
f01026ec:	68 5d 04 00 00       	push   $0x45d
f01026f1:	68 21 74 10 f0       	push   $0xf0107421
f01026f6:	e8 45 d9 ff ff       	call   f0100040 <_panic>
	assert(mm1 % PGSIZE == 0 && mm2 % PGSIZE == 0);
f01026fb:	68 ec 70 10 f0       	push   $0xf01070ec
f0102700:	68 47 74 10 f0       	push   $0xf0107447
f0102705:	68 5f 04 00 00       	push   $0x45f
f010270a:	68 21 74 10 f0       	push   $0xf0107421
f010270f:	e8 2c d9 ff ff       	call   f0100040 <_panic>
	assert(mm1 + 8192 <= mm2);
f0102714:	68 dc 76 10 f0       	push   $0xf01076dc
f0102719:	68 47 74 10 f0       	push   $0xf0107447
f010271e:	68 61 04 00 00       	push   $0x461
f0102723:	68 21 74 10 f0       	push   $0xf0107421
f0102728:	e8 13 d9 ff ff       	call   f0100040 <_panic>
	assert(check_va2pa(kern_pgdir, mm1) == 0);
f010272d:	68 14 71 10 f0       	push   $0xf0107114
f0102732:	68 47 74 10 f0       	push   $0xf0107447
f0102737:	68 63 04 00 00       	push   $0x463
f010273c:	68 21 74 10 f0       	push   $0xf0107421
f0102741:	e8 fa d8 ff ff       	call   f0100040 <_panic>
	assert(check_va2pa(kern_pgdir, mm1+PGSIZE) == PGSIZE);
f0102746:	68 38 71 10 f0       	push   $0xf0107138
f010274b:	68 47 74 10 f0       	push   $0xf0107447
f0102750:	68 64 04 00 00       	push   $0x464
f0102755:	68 21 74 10 f0       	push   $0xf0107421
f010275a:	e8 e1 d8 ff ff       	call   f0100040 <_panic>
	assert(check_va2pa(kern_pgdir, mm2) == 0);
f010275f:	68 68 71 10 f0       	push   $0xf0107168
f0102764:	68 47 74 10 f0       	push   $0xf0107447
f0102769:	68 65 04 00 00       	push   $0x465
f010276e:	68 21 74 10 f0       	push   $0xf0107421
f0102773:	e8 c8 d8 ff ff       	call   f0100040 <_panic>
	assert(check_va2pa(kern_pgdir, mm2+PGSIZE) == ~0);
f0102778:	68 8c 71 10 f0       	push   $0xf010718c
f010277d:	68 47 74 10 f0       	push   $0xf0107447
f0102782:	68 66 04 00 00       	push   $0x466
f0102787:	68 21 74 10 f0       	push   $0xf0107421
f010278c:	e8 af d8 ff ff       	call   f0100040 <_panic>
	assert(*pgdir_walk(kern_pgdir, (void*) mm1, 0) & (PTE_W|PTE_PWT|PTE_PCD));
f0102791:	68 b8 71 10 f0       	push   $0xf01071b8
f0102796:	68 47 74 10 f0       	push   $0xf0107447
f010279b:	68 68 04 00 00       	push   $0x468
f01027a0:	68 21 74 10 f0       	push   $0xf0107421
f01027a5:	e8 96 d8 ff ff       	call   f0100040 <_panic>
	assert(!(*pgdir_walk(kern_pgdir, (void*) mm1, 0) & PTE_U));
f01027aa:	68 fc 71 10 f0       	push   $0xf01071fc
f01027af:	68 47 74 10 f0       	push   $0xf0107447
f01027b4:	68 69 04 00 00       	push   $0x469
f01027b9:	68 21 74 10 f0       	push   $0xf0107421
f01027be:	e8 7d d8 ff ff       	call   f0100040 <_panic>
		_panic(file, line, "PADDR called with invalid kva %08lx", kva);
f01027c3:	50                   	push   %eax
f01027c4:	68 c8 65 10 f0       	push   $0xf01065c8
f01027c9:	68 c3 00 00 00       	push   $0xc3
f01027ce:	68 21 74 10 f0       	push   $0xf0107421
f01027d3:	e8 68 d8 ff ff       	call   f0100040 <_panic>
f01027d8:	50                   	push   %eax
f01027d9:	68 c8 65 10 f0       	push   $0xf01065c8
f01027de:	68 cb 00 00 00       	push   $0xcb
f01027e3:	68 21 74 10 f0       	push   $0xf0107421
f01027e8:	e8 53 d8 ff ff       	call   f0100040 <_panic>
f01027ed:	50                   	push   %eax
f01027ee:	68 c8 65 10 f0       	push   $0xf01065c8
f01027f3:	68 d7 00 00 00       	push   $0xd7
f01027f8:	68 21 74 10 f0       	push   $0xf0107421
f01027fd:	e8 3e d8 ff ff       	call   f0100040 <_panic>
f0102802:	53                   	push   %ebx
f0102803:	68 c8 65 10 f0       	push   $0xf01065c8
f0102808:	68 1a 01 00 00       	push   $0x11a
f010280d:	68 21 74 10 f0       	push   $0xf0107421
f0102812:	e8 29 d8 ff ff       	call   f0100040 <_panic>
f0102817:	56                   	push   %esi
f0102818:	68 c8 65 10 f0       	push   $0xf01065c8
f010281d:	68 81 03 00 00       	push   $0x381
f0102822:	68 21 74 10 f0       	push   $0xf0107421
f0102827:	e8 14 d8 ff ff       	call   f0100040 <_panic>
	for (i = 0; i < n; i += PGSIZE)
f010282c:	81 c3 00 10 00 00    	add    $0x1000,%ebx
f0102832:	39 5d cc             	cmp    %ebx,-0x34(%ebp)
f0102835:	76 3a                	jbe    f0102871 <mem_init+0x1627>
		assert(check_va2pa(pgdir, UPAGES + i) == PADDR(pages) + i);
f0102837:	8d 93 00 00 00 ef    	lea    -0x11000000(%ebx),%edx
f010283d:	8b 45 d4             	mov    -0x2c(%ebp),%eax
f0102840:	e8 42 e2 ff ff       	call   f0100a87 <check_va2pa>
	if ((uint32_t)kva < KERNBASE)
f0102845:	81 7d c8 ff ff ff ef 	cmpl   $0xefffffff,-0x38(%ebp)
f010284c:	76 c9                	jbe    f0102817 <mem_init+0x15cd>
f010284e:	8b 4d c4             	mov    -0x3c(%ebp),%ecx
f0102851:	8d 14 0b             	lea    (%ebx,%ecx,1),%edx
f0102854:	39 d0                	cmp    %edx,%eax
f0102856:	74 d4                	je     f010282c <mem_init+0x15e2>
f0102858:	68 30 72 10 f0       	push   $0xf0107230
f010285d:	68 47 74 10 f0       	push   $0xf0107447
f0102862:	68 81 03 00 00       	push   $0x381
f0102867:	68 21 74 10 f0       	push   $0xf0107421
f010286c:	e8 cf d7 ff ff       	call   f0100040 <_panic>
		assert(check_va2pa(pgdir, UENVS + i) == PADDR(envs) + i);
f0102871:	a1 48 72 21 f0       	mov    0xf0217248,%eax
f0102876:	89 45 c8             	mov    %eax,-0x38(%ebp)
f0102879:	89 45 cc             	mov    %eax,-0x34(%ebp)
f010287c:	bb 00 00 c0 ee       	mov    $0xeec00000,%ebx
f0102881:	8d b0 00 00 40 21    	lea    0x21400000(%eax),%esi
f0102887:	89 da                	mov    %ebx,%edx
f0102889:	8b 45 d4             	mov    -0x2c(%ebp),%eax
f010288c:	e8 f6 e1 ff ff       	call   f0100a87 <check_va2pa>
f0102891:	81 7d cc ff ff ff ef 	cmpl   $0xefffffff,-0x34(%ebp)
f0102898:	76 3b                	jbe    f01028d5 <mem_init+0x168b>
f010289a:	8d 14 1e             	lea    (%esi,%ebx,1),%edx
f010289d:	39 d0                	cmp    %edx,%eax
f010289f:	75 4b                	jne    f01028ec <mem_init+0x16a2>
f01028a1:	81 c3 00 10 00 00    	add    $0x1000,%ebx
	for (i = 0; i < n; i += PGSIZE)
f01028a7:	81 fb 00 f0 c1 ee    	cmp    $0xeec1f000,%ebx
f01028ad:	75 d8                	jne    f0102887 <mem_init+0x163d>
	for (i = 0; i < npages * PGSIZE; i += PGSIZE)
f01028af:	8b 75 c0             	mov    -0x40(%ebp),%esi
f01028b2:	c1 e6 0c             	shl    $0xc,%esi
f01028b5:	89 fb                	mov    %edi,%ebx
f01028b7:	39 f3                	cmp    %esi,%ebx
f01028b9:	73 63                	jae    f010291e <mem_init+0x16d4>
		assert(check_va2pa(pgdir, KERNBASE + i) == i);
f01028bb:	8d 93 00 00 00 f0    	lea    -0x10000000(%ebx),%edx
f01028c1:	8b 45 d4             	mov    -0x2c(%ebp),%eax
f01028c4:	e8 be e1 ff ff       	call   f0100a87 <check_va2pa>
f01028c9:	39 c3                	cmp    %eax,%ebx
f01028cb:	75 38                	jne    f0102905 <mem_init+0x16bb>
	for (i = 0; i < npages * PGSIZE; i += PGSIZE)
f01028cd:	81 c3 00 10 00 00    	add    $0x1000,%ebx
f01028d3:	eb e2                	jmp    f01028b7 <mem_init+0x166d>
		_panic(file, line, "PADDR called with invalid kva %08lx", kva);
f01028d5:	ff 75 c8             	pushl  -0x38(%ebp)
f01028d8:	68 c8 65 10 f0       	push   $0xf01065c8
f01028dd:	68 86 03 00 00       	push   $0x386
f01028e2:	68 21 74 10 f0       	push   $0xf0107421
f01028e7:	e8 54 d7 ff ff       	call   f0100040 <_panic>
		assert(check_va2pa(pgdir, UENVS + i) == PADDR(envs) + i);
f01028ec:	68 64 72 10 f0       	push   $0xf0107264
f01028f1:	68 47 74 10 f0       	push   $0xf0107447
f01028f6:	68 86 03 00 00       	push   $0x386
f01028fb:	68 21 74 10 f0       	push   $0xf0107421
f0102900:	e8 3b d7 ff ff       	call   f0100040 <_panic>
		assert(check_va2pa(pgdir, KERNBASE + i) == i);
f0102905:	68 98 72 10 f0       	push   $0xf0107298
f010290a:	68 47 74 10 f0       	push   $0xf0107447
f010290f:	68 8a 03 00 00       	push   $0x38a
f0102914:	68 21 74 10 f0       	push   $0xf0107421
f0102919:	e8 22 d7 ff ff       	call   f0100040 <_panic>
f010291e:	c7 45 cc 00 90 22 00 	movl   $0x229000,-0x34(%ebp)
	for (i = 0; i < npages * PGSIZE; i += PGSIZE)
f0102925:	bb 00 80 ff ef       	mov    $0xefff8000,%ebx
f010292a:	89 7d c0             	mov    %edi,-0x40(%ebp)
f010292d:	8d bb 00 80 ff ff    	lea    -0x8000(%ebx),%edi
			assert(check_va2pa(pgdir, base + KSTKGAP + i)
f0102933:	8b 45 d0             	mov    -0x30(%ebp),%eax
f0102936:	89 45 bc             	mov    %eax,-0x44(%ebp)
f0102939:	89 de                	mov    %ebx,%esi
f010293b:	8b 45 cc             	mov    -0x34(%ebp),%eax
f010293e:	05 00 80 ff 0f       	add    $0xfff8000,%eax
f0102943:	89 45 c8             	mov    %eax,-0x38(%ebp)
		for (i = 0; i < KSTKSIZE; i += PGSIZE)
f0102946:	8d 83 00 80 00 00    	lea    0x8000(%ebx),%eax
f010294c:	89 45 c4             	mov    %eax,-0x3c(%ebp)
			assert(check_va2pa(pgdir, base + KSTKGAP + i)
f010294f:	89 f2                	mov    %esi,%edx
f0102951:	8b 45 d4             	mov    -0x2c(%ebp),%eax
f0102954:	e8 2e e1 ff ff       	call   f0100a87 <check_va2pa>
	if ((uint32_t)kva < KERNBASE)
f0102959:	81 7d d0 ff ff ff ef 	cmpl   $0xefffffff,-0x30(%ebp)
f0102960:	76 58                	jbe    f01029ba <mem_init+0x1770>
f0102962:	8b 4d c8             	mov    -0x38(%ebp),%ecx
f0102965:	8d 14 31             	lea    (%ecx,%esi,1),%edx
f0102968:	39 d0                	cmp    %edx,%eax
f010296a:	75 65                	jne    f01029d1 <mem_init+0x1787>
f010296c:	81 c6 00 10 00 00    	add    $0x1000,%esi
		for (i = 0; i < KSTKSIZE; i += PGSIZE)
f0102972:	3b 75 c4             	cmp    -0x3c(%ebp),%esi
f0102975:	75 d8                	jne    f010294f <mem_init+0x1705>
			assert(check_va2pa(pgdir, base + i) == ~0);
f0102977:	89 fa                	mov    %edi,%edx
f0102979:	8b 45 d4             	mov    -0x2c(%ebp),%eax
f010297c:	e8 06 e1 ff ff       	call   f0100a87 <check_va2pa>
f0102981:	83 f8 ff             	cmp    $0xffffffff,%eax
f0102984:	75 64                	jne    f01029ea <mem_init+0x17a0>
f0102986:	81 c7 00 10 00 00    	add    $0x1000,%edi
		for (i = 0; i < KSTKGAP; i += PGSIZE)
f010298c:	39 df                	cmp    %ebx,%edi
f010298e:	75 e7                	jne    f0102977 <mem_init+0x172d>
f0102990:	81 eb 00 00 01 00    	sub    $0x10000,%ebx
f0102996:	81 45 d0 00 80 00 00 	addl   $0x8000,-0x30(%ebp)
f010299d:	8b 45 d0             	mov    -0x30(%ebp),%eax
f01029a0:	81 45 cc 00 80 01 00 	addl   $0x18000,-0x34(%ebp)
	for (n = 0; n < NCPU; n++) {
f01029a7:	3d 00 90 25 f0       	cmp    $0xf0259000,%eax
f01029ac:	0f 85 7b ff ff ff    	jne    f010292d <mem_init+0x16e3>
f01029b2:	8b 7d c0             	mov    -0x40(%ebp),%edi
f01029b5:	e9 84 00 00 00       	jmp    f0102a3e <mem_init+0x17f4>
		_panic(file, line, "PADDR called with invalid kva %08lx", kva);
f01029ba:	ff 75 bc             	pushl  -0x44(%ebp)
f01029bd:	68 c8 65 10 f0       	push   $0xf01065c8
f01029c2:	68 92 03 00 00       	push   $0x392
f01029c7:	68 21 74 10 f0       	push   $0xf0107421
f01029cc:	e8 6f d6 ff ff       	call   f0100040 <_panic>
			assert(check_va2pa(pgdir, base + KSTKGAP + i)
f01029d1:	68 c0 72 10 f0       	push   $0xf01072c0
f01029d6:	68 47 74 10 f0       	push   $0xf0107447
f01029db:	68 91 03 00 00       	push   $0x391
f01029e0:	68 21 74 10 f0       	push   $0xf0107421
f01029e5:	e8 56 d6 ff ff       	call   f0100040 <_panic>
			assert(check_va2pa(pgdir, base + i) == ~0);
f01029ea:	68 08 73 10 f0       	push   $0xf0107308
f01029ef:	68 47 74 10 f0       	push   $0xf0107447
f01029f4:	68 94 03 00 00       	push   $0x394
f01029f9:	68 21 74 10 f0       	push   $0xf0107421
f01029fe:	e8 3d d6 ff ff       	call   f0100040 <_panic>
			assert(pgdir[i] & PTE_P);
f0102a03:	8b 45 d4             	mov    -0x2c(%ebp),%eax
f0102a06:	f6 04 b8 01          	testb  $0x1,(%eax,%edi,4)
f0102a0a:	75 4e                	jne    f0102a5a <mem_init+0x1810>
f0102a0c:	68 07 77 10 f0       	push   $0xf0107707
f0102a11:	68 47 74 10 f0       	push   $0xf0107447
f0102a16:	68 9f 03 00 00       	push   $0x39f
f0102a1b:	68 21 74 10 f0       	push   $0xf0107421
f0102a20:	e8 1b d6 ff ff       	call   f0100040 <_panic>
				assert(pgdir[i] & PTE_P);
f0102a25:	8b 45 d4             	mov    -0x2c(%ebp),%eax
f0102a28:	8b 04 b8             	mov    (%eax,%edi,4),%eax
f0102a2b:	a8 01                	test   $0x1,%al
f0102a2d:	74 30                	je     f0102a5f <mem_init+0x1815>
				assert(pgdir[i] & PTE_W);
f0102a2f:	a8 02                	test   $0x2,%al
f0102a31:	74 45                	je     f0102a78 <mem_init+0x182e>
	for (i = 0; i < NPDENTRIES; i++) {
f0102a33:	83 c7 01             	add    $0x1,%edi
f0102a36:	81 ff 00 04 00 00    	cmp    $0x400,%edi
f0102a3c:	74 6c                	je     f0102aaa <mem_init+0x1860>
		switch (i) {
f0102a3e:	8d 87 45 fc ff ff    	lea    -0x3bb(%edi),%eax
f0102a44:	83 f8 04             	cmp    $0x4,%eax
f0102a47:	76 ba                	jbe    f0102a03 <mem_init+0x17b9>
			if (i >= PDX(KERNBASE)) {
f0102a49:	81 ff bf 03 00 00    	cmp    $0x3bf,%edi
f0102a4f:	77 d4                	ja     f0102a25 <mem_init+0x17db>
				assert(pgdir[i] == 0);
f0102a51:	8b 45 d4             	mov    -0x2c(%ebp),%eax
f0102a54:	83 3c b8 00          	cmpl   $0x0,(%eax,%edi,4)
f0102a58:	75 37                	jne    f0102a91 <mem_init+0x1847>
	for (i = 0; i < NPDENTRIES; i++) {
f0102a5a:	83 c7 01             	add    $0x1,%edi
f0102a5d:	eb df                	jmp    f0102a3e <mem_init+0x17f4>
				assert(pgdir[i] & PTE_P);
f0102a5f:	68 07 77 10 f0       	push   $0xf0107707
f0102a64:	68 47 74 10 f0       	push   $0xf0107447
f0102a69:	68 a3 03 00 00       	push   $0x3a3
f0102a6e:	68 21 74 10 f0       	push   $0xf0107421
f0102a73:	e8 c8 d5 ff ff       	call   f0100040 <_panic>
				assert(pgdir[i] & PTE_W);
f0102a78:	68 18 77 10 f0       	push   $0xf0107718
f0102a7d:	68 47 74 10 f0       	push   $0xf0107447
f0102a82:	68 a4 03 00 00       	push   $0x3a4
f0102a87:	68 21 74 10 f0       	push   $0xf0107421
f0102a8c:	e8 af d5 ff ff       	call   f0100040 <_panic>
				assert(pgdir[i] == 0);
f0102a91:	68 29 77 10 f0       	push   $0xf0107729
f0102a96:	68 47 74 10 f0       	push   $0xf0107447
f0102a9b:	68 a6 03 00 00       	push   $0x3a6
f0102aa0:	68 21 74 10 f0       	push   $0xf0107421
f0102aa5:	e8 96 d5 ff ff       	call   f0100040 <_panic>
	cprintf("check_kern_pgdir() succeeded!\n");
f0102aaa:	83 ec 0c             	sub    $0xc,%esp
f0102aad:	68 2c 73 10 f0       	push   $0xf010732c
f0102ab2:	e8 26 0d 00 00       	call   f01037dd <cprintf>
	lcr3(PADDR(kern_pgdir));
f0102ab7:	a1 8c 7e 21 f0       	mov    0xf0217e8c,%eax
	if ((uint32_t)kva < KERNBASE)
f0102abc:	83 c4 10             	add    $0x10,%esp
f0102abf:	3d ff ff ff ef       	cmp    $0xefffffff,%eax
f0102ac4:	0f 86 03 02 00 00    	jbe    f0102ccd <mem_init+0x1a83>
	return (physaddr_t)kva - KERNBASE;
f0102aca:	05 00 00 00 10       	add    $0x10000000,%eax
	asm volatile("movl %0,%%cr3" : : "r" (val));
f0102acf:	0f 22 d8             	mov    %eax,%cr3
	check_page_free_list(0);
f0102ad2:	b8 00 00 00 00       	mov    $0x0,%eax
f0102ad7:	e8 0e e0 ff ff       	call   f0100aea <check_page_free_list>
	asm volatile("movl %%cr0,%0" : "=r" (val));
f0102adc:	0f 20 c0             	mov    %cr0,%eax
	cr0 &= ~(CR0_TS|CR0_EM);
f0102adf:	83 e0 f3             	and    $0xfffffff3,%eax
f0102ae2:	0d 23 00 05 80       	or     $0x80050023,%eax
	asm volatile("movl %0,%%cr0" : : "r" (val));
f0102ae7:	0f 22 c0             	mov    %eax,%cr0
	uintptr_t va;
	int i;

	// check that we can read and write installed pages
	pp1 = pp2 = 0;
	assert((pp0 = page_alloc(0)));
f0102aea:	83 ec 0c             	sub    $0xc,%esp
f0102aed:	6a 00                	push   $0x0
f0102aef:	e8 9f e3 ff ff       	call   f0100e93 <page_alloc>
f0102af4:	89 c6                	mov    %eax,%esi
f0102af6:	83 c4 10             	add    $0x10,%esp
f0102af9:	85 c0                	test   %eax,%eax
f0102afb:	0f 84 e1 01 00 00    	je     f0102ce2 <mem_init+0x1a98>
	assert((pp1 = page_alloc(0)));
f0102b01:	83 ec 0c             	sub    $0xc,%esp
f0102b04:	6a 00                	push   $0x0
f0102b06:	e8 88 e3 ff ff       	call   f0100e93 <page_alloc>
f0102b0b:	89 c7                	mov    %eax,%edi
f0102b0d:	83 c4 10             	add    $0x10,%esp
f0102b10:	85 c0                	test   %eax,%eax
f0102b12:	0f 84 e3 01 00 00    	je     f0102cfb <mem_init+0x1ab1>
	assert((pp2 = page_alloc(0)));
f0102b18:	83 ec 0c             	sub    $0xc,%esp
f0102b1b:	6a 00                	push   $0x0
f0102b1d:	e8 71 e3 ff ff       	call   f0100e93 <page_alloc>
f0102b22:	89 c3                	mov    %eax,%ebx
f0102b24:	83 c4 10             	add    $0x10,%esp
f0102b27:	85 c0                	test   %eax,%eax
f0102b29:	0f 84 e5 01 00 00    	je     f0102d14 <mem_init+0x1aca>
	page_free(pp0);
f0102b2f:	83 ec 0c             	sub    $0xc,%esp
f0102b32:	56                   	push   %esi
f0102b33:	e8 d4 e3 ff ff       	call   f0100f0c <page_free>
	return (pp - pages) << PGSHIFT;
f0102b38:	89 f8                	mov    %edi,%eax
f0102b3a:	2b 05 90 7e 21 f0    	sub    0xf0217e90,%eax
f0102b40:	c1 f8 03             	sar    $0x3,%eax
f0102b43:	89 c2                	mov    %eax,%edx
f0102b45:	c1 e2 0c             	shl    $0xc,%edx
	if (PGNUM(pa) >= npages)
f0102b48:	25 ff ff 0f 00       	and    $0xfffff,%eax
f0102b4d:	83 c4 10             	add    $0x10,%esp
f0102b50:	3b 05 88 7e 21 f0    	cmp    0xf0217e88,%eax
f0102b56:	0f 83 d1 01 00 00    	jae    f0102d2d <mem_init+0x1ae3>
	memset(page2kva(pp1), 1, PGSIZE);
f0102b5c:	83 ec 04             	sub    $0x4,%esp
f0102b5f:	68 00 10 00 00       	push   $0x1000
f0102b64:	6a 01                	push   $0x1
	return (void *)(pa + KERNBASE);
f0102b66:	81 ea 00 00 00 10    	sub    $0x10000000,%edx
f0102b6c:	52                   	push   %edx
f0102b6d:	e8 78 2d 00 00       	call   f01058ea <memset>
	return (pp - pages) << PGSHIFT;
f0102b72:	89 d8                	mov    %ebx,%eax
f0102b74:	2b 05 90 7e 21 f0    	sub    0xf0217e90,%eax
f0102b7a:	c1 f8 03             	sar    $0x3,%eax
f0102b7d:	89 c2                	mov    %eax,%edx
f0102b7f:	c1 e2 0c             	shl    $0xc,%edx
	if (PGNUM(pa) >= npages)
f0102b82:	25 ff ff 0f 00       	and    $0xfffff,%eax
f0102b87:	83 c4 10             	add    $0x10,%esp
f0102b8a:	3b 05 88 7e 21 f0    	cmp    0xf0217e88,%eax
f0102b90:	0f 83 a9 01 00 00    	jae    f0102d3f <mem_init+0x1af5>
	memset(page2kva(pp2), 2, PGSIZE);
f0102b96:	83 ec 04             	sub    $0x4,%esp
f0102b99:	68 00 10 00 00       	push   $0x1000
f0102b9e:	6a 02                	push   $0x2
	return (void *)(pa + KERNBASE);
f0102ba0:	81 ea 00 00 00 10    	sub    $0x10000000,%edx
f0102ba6:	52                   	push   %edx
f0102ba7:	e8 3e 2d 00 00       	call   f01058ea <memset>
	page_insert(kern_pgdir, pp1, (void*) PGSIZE, PTE_W);
f0102bac:	6a 02                	push   $0x2
f0102bae:	68 00 10 00 00       	push   $0x1000
f0102bb3:	57                   	push   %edi
f0102bb4:	ff 35 8c 7e 21 f0    	pushl  0xf0217e8c
f0102bba:	e8 9a e5 ff ff       	call   f0101159 <page_insert>
	assert(pp1->pp_ref == 1);
f0102bbf:	83 c4 20             	add    $0x20,%esp
f0102bc2:	66 83 7f 04 01       	cmpw   $0x1,0x4(%edi)
f0102bc7:	0f 85 84 01 00 00    	jne    f0102d51 <mem_init+0x1b07>
	assert(*(uint32_t *)PGSIZE == 0x01010101U);
f0102bcd:	81 3d 00 10 00 00 01 	cmpl   $0x1010101,0x1000
f0102bd4:	01 01 01 
f0102bd7:	0f 85 8d 01 00 00    	jne    f0102d6a <mem_init+0x1b20>
	page_insert(kern_pgdir, pp2, (void*) PGSIZE, PTE_W);
f0102bdd:	6a 02                	push   $0x2
f0102bdf:	68 00 10 00 00       	push   $0x1000
f0102be4:	53                   	push   %ebx
f0102be5:	ff 35 8c 7e 21 f0    	pushl  0xf0217e8c
f0102beb:	e8 69 e5 ff ff       	call   f0101159 <page_insert>
	assert(*(uint32_t *)PGSIZE == 0x02020202U);
f0102bf0:	83 c4 10             	add    $0x10,%esp
f0102bf3:	81 3d 00 10 00 00 02 	cmpl   $0x2020202,0x1000
f0102bfa:	02 02 02 
f0102bfd:	0f 85 80 01 00 00    	jne    f0102d83 <mem_init+0x1b39>
	assert(pp2->pp_ref == 1);
f0102c03:	66 83 7b 04 01       	cmpw   $0x1,0x4(%ebx)
f0102c08:	0f 85 8e 01 00 00    	jne    f0102d9c <mem_init+0x1b52>
	assert(pp1->pp_ref == 0);
f0102c0e:	66 83 7f 04 00       	cmpw   $0x0,0x4(%edi)
f0102c13:	0f 85 9c 01 00 00    	jne    f0102db5 <mem_init+0x1b6b>
	*(uint32_t *)PGSIZE = 0x03030303U;
f0102c19:	c7 05 00 10 00 00 03 	movl   $0x3030303,0x1000
f0102c20:	03 03 03 
	return (pp - pages) << PGSHIFT;
f0102c23:	89 d8                	mov    %ebx,%eax
f0102c25:	2b 05 90 7e 21 f0    	sub    0xf0217e90,%eax
f0102c2b:	c1 f8 03             	sar    $0x3,%eax
f0102c2e:	89 c2                	mov    %eax,%edx
f0102c30:	c1 e2 0c             	shl    $0xc,%edx
	if (PGNUM(pa) >= npages)
f0102c33:	25 ff ff 0f 00       	and    $0xfffff,%eax
f0102c38:	3b 05 88 7e 21 f0    	cmp    0xf0217e88,%eax
f0102c3e:	0f 83 8a 01 00 00    	jae    f0102dce <mem_init+0x1b84>
	assert(*(uint32_t *)page2kva(pp2) == 0x03030303U);
f0102c44:	81 ba 00 00 00 f0 03 	cmpl   $0x3030303,-0x10000000(%edx)
f0102c4b:	03 03 03 
f0102c4e:	0f 85 8c 01 00 00    	jne    f0102de0 <mem_init+0x1b96>
	page_remove(kern_pgdir, (void*) PGSIZE);
f0102c54:	83 ec 08             	sub    $0x8,%esp
f0102c57:	68 00 10 00 00       	push   $0x1000
f0102c5c:	ff 35 8c 7e 21 f0    	pushl  0xf0217e8c
f0102c62:	e8 a8 e4 ff ff       	call   f010110f <page_remove>
	assert(pp2->pp_ref == 0);
f0102c67:	83 c4 10             	add    $0x10,%esp
f0102c6a:	66 83 7b 04 00       	cmpw   $0x0,0x4(%ebx)
f0102c6f:	0f 85 84 01 00 00    	jne    f0102df9 <mem_init+0x1baf>

	// forcibly take pp0 back
	assert(PTE_ADDR(kern_pgdir[0]) == page2pa(pp0));
f0102c75:	8b 0d 8c 7e 21 f0    	mov    0xf0217e8c,%ecx
f0102c7b:	8b 11                	mov    (%ecx),%edx
f0102c7d:	81 e2 00 f0 ff ff    	and    $0xfffff000,%edx
	return (pp - pages) << PGSHIFT;
f0102c83:	89 f0                	mov    %esi,%eax
f0102c85:	2b 05 90 7e 21 f0    	sub    0xf0217e90,%eax
f0102c8b:	c1 f8 03             	sar    $0x3,%eax
f0102c8e:	c1 e0 0c             	shl    $0xc,%eax
f0102c91:	39 c2                	cmp    %eax,%edx
f0102c93:	0f 85 79 01 00 00    	jne    f0102e12 <mem_init+0x1bc8>
	kern_pgdir[0] = 0;
f0102c99:	c7 01 00 00 00 00    	movl   $0x0,(%ecx)
	assert(pp0->pp_ref == 1);
f0102c9f:	66 83 7e 04 01       	cmpw   $0x1,0x4(%esi)
f0102ca4:	0f 85 81 01 00 00    	jne    f0102e2b <mem_init+0x1be1>
	pp0->pp_ref = 0;
f0102caa:	66 c7 46 04 00 00    	movw   $0x0,0x4(%esi)

	// free the pages we took
	page_free(pp0);
f0102cb0:	83 ec 0c             	sub    $0xc,%esp
f0102cb3:	56                   	push   %esi
f0102cb4:	e8 53 e2 ff ff       	call   f0100f0c <page_free>

	cprintf("check_page_installed_pgdir() succeeded!\n");
f0102cb9:	c7 04 24 c0 73 10 f0 	movl   $0xf01073c0,(%esp)
f0102cc0:	e8 18 0b 00 00       	call   f01037dd <cprintf>
}
f0102cc5:	8d 65 f4             	lea    -0xc(%ebp),%esp
f0102cc8:	5b                   	pop    %ebx
f0102cc9:	5e                   	pop    %esi
f0102cca:	5f                   	pop    %edi
f0102ccb:	5d                   	pop    %ebp
f0102ccc:	c3                   	ret    
		_panic(file, line, "PADDR called with invalid kva %08lx", kva);
f0102ccd:	50                   	push   %eax
f0102cce:	68 c8 65 10 f0       	push   $0xf01065c8
f0102cd3:	68 f1 00 00 00       	push   $0xf1
f0102cd8:	68 21 74 10 f0       	push   $0xf0107421
f0102cdd:	e8 5e d3 ff ff       	call   f0100040 <_panic>
	assert((pp0 = page_alloc(0)));
f0102ce2:	68 13 75 10 f0       	push   $0xf0107513
f0102ce7:	68 47 74 10 f0       	push   $0xf0107447
f0102cec:	68 7e 04 00 00       	push   $0x47e
f0102cf1:	68 21 74 10 f0       	push   $0xf0107421
f0102cf6:	e8 45 d3 ff ff       	call   f0100040 <_panic>
	assert((pp1 = page_alloc(0)));
f0102cfb:	68 29 75 10 f0       	push   $0xf0107529
f0102d00:	68 47 74 10 f0       	push   $0xf0107447
f0102d05:	68 7f 04 00 00       	push   $0x47f
f0102d0a:	68 21 74 10 f0       	push   $0xf0107421
f0102d0f:	e8 2c d3 ff ff       	call   f0100040 <_panic>
	assert((pp2 = page_alloc(0)));
f0102d14:	68 3f 75 10 f0       	push   $0xf010753f
f0102d19:	68 47 74 10 f0       	push   $0xf0107447
f0102d1e:	68 80 04 00 00       	push   $0x480
f0102d23:	68 21 74 10 f0       	push   $0xf0107421
f0102d28:	e8 13 d3 ff ff       	call   f0100040 <_panic>
		_panic(file, line, "KADDR called with invalid pa %08lx", pa);
f0102d2d:	52                   	push   %edx
f0102d2e:	68 a4 65 10 f0       	push   $0xf01065a4
f0102d33:	6a 58                	push   $0x58
f0102d35:	68 2d 74 10 f0       	push   $0xf010742d
f0102d3a:	e8 01 d3 ff ff       	call   f0100040 <_panic>
f0102d3f:	52                   	push   %edx
f0102d40:	68 a4 65 10 f0       	push   $0xf01065a4
f0102d45:	6a 58                	push   $0x58
f0102d47:	68 2d 74 10 f0       	push   $0xf010742d
f0102d4c:	e8 ef d2 ff ff       	call   f0100040 <_panic>
	assert(pp1->pp_ref == 1);
f0102d51:	68 10 76 10 f0       	push   $0xf0107610
f0102d56:	68 47 74 10 f0       	push   $0xf0107447
f0102d5b:	68 85 04 00 00       	push   $0x485
f0102d60:	68 21 74 10 f0       	push   $0xf0107421
f0102d65:	e8 d6 d2 ff ff       	call   f0100040 <_panic>
	assert(*(uint32_t *)PGSIZE == 0x01010101U);
f0102d6a:	68 4c 73 10 f0       	push   $0xf010734c
f0102d6f:	68 47 74 10 f0       	push   $0xf0107447
f0102d74:	68 86 04 00 00       	push   $0x486
f0102d79:	68 21 74 10 f0       	push   $0xf0107421
f0102d7e:	e8 bd d2 ff ff       	call   f0100040 <_panic>
	assert(*(uint32_t *)PGSIZE == 0x02020202U);
f0102d83:	68 70 73 10 f0       	push   $0xf0107370
f0102d88:	68 47 74 10 f0       	push   $0xf0107447
f0102d8d:	68 88 04 00 00       	push   $0x488
f0102d92:	68 21 74 10 f0       	push   $0xf0107421
f0102d97:	e8 a4 d2 ff ff       	call   f0100040 <_panic>
	assert(pp2->pp_ref == 1);
f0102d9c:	68 32 76 10 f0       	push   $0xf0107632
f0102da1:	68 47 74 10 f0       	push   $0xf0107447
f0102da6:	68 89 04 00 00       	push   $0x489
f0102dab:	68 21 74 10 f0       	push   $0xf0107421
f0102db0:	e8 8b d2 ff ff       	call   f0100040 <_panic>
	assert(pp1->pp_ref == 0);
f0102db5:	68 9c 76 10 f0       	push   $0xf010769c
f0102dba:	68 47 74 10 f0       	push   $0xf0107447
f0102dbf:	68 8a 04 00 00       	push   $0x48a
f0102dc4:	68 21 74 10 f0       	push   $0xf0107421
f0102dc9:	e8 72 d2 ff ff       	call   f0100040 <_panic>
f0102dce:	52                   	push   %edx
f0102dcf:	68 a4 65 10 f0       	push   $0xf01065a4
f0102dd4:	6a 58                	push   $0x58
f0102dd6:	68 2d 74 10 f0       	push   $0xf010742d
f0102ddb:	e8 60 d2 ff ff       	call   f0100040 <_panic>
	assert(*(uint32_t *)page2kva(pp2) == 0x03030303U);
f0102de0:	68 94 73 10 f0       	push   $0xf0107394
f0102de5:	68 47 74 10 f0       	push   $0xf0107447
f0102dea:	68 8c 04 00 00       	push   $0x48c
f0102def:	68 21 74 10 f0       	push   $0xf0107421
f0102df4:	e8 47 d2 ff ff       	call   f0100040 <_panic>
	assert(pp2->pp_ref == 0);
f0102df9:	68 6a 76 10 f0       	push   $0xf010766a
f0102dfe:	68 47 74 10 f0       	push   $0xf0107447
f0102e03:	68 8e 04 00 00       	push   $0x48e
f0102e08:	68 21 74 10 f0       	push   $0xf0107421
f0102e0d:	e8 2e d2 ff ff       	call   f0100040 <_panic>
	assert(PTE_ADDR(kern_pgdir[0]) == page2pa(pp0));
f0102e12:	68 1c 6d 10 f0       	push   $0xf0106d1c
f0102e17:	68 47 74 10 f0       	push   $0xf0107447
f0102e1c:	68 91 04 00 00       	push   $0x491
f0102e21:	68 21 74 10 f0       	push   $0xf0107421
f0102e26:	e8 15 d2 ff ff       	call   f0100040 <_panic>
	assert(pp0->pp_ref == 1);
f0102e2b:	68 21 76 10 f0       	push   $0xf0107621
f0102e30:	68 47 74 10 f0       	push   $0xf0107447
f0102e35:	68 93 04 00 00       	push   $0x493
f0102e3a:	68 21 74 10 f0       	push   $0xf0107421
f0102e3f:	e8 fc d1 ff ff       	call   f0100040 <_panic>

f0102e44 <user_mem_check>:
{
f0102e44:	f3 0f 1e fb          	endbr32 
f0102e48:	55                   	push   %ebp
f0102e49:	89 e5                	mov    %esp,%ebp
f0102e4b:	57                   	push   %edi
f0102e4c:	56                   	push   %esi
f0102e4d:	53                   	push   %ebx
f0102e4e:	83 ec 0c             	sub    $0xc,%esp
f0102e51:	8b 75 14             	mov    0x14(%ebp),%esi
	uint32_t begin = (uint32_t) ROUNDDOWN(va, PGSIZE); 
f0102e54:	8b 5d 0c             	mov    0xc(%ebp),%ebx
f0102e57:	81 e3 00 f0 ff ff    	and    $0xfffff000,%ebx
	uint32_t end = (uint32_t) ROUNDUP(va+len, PGSIZE);
f0102e5d:	8b 7d 0c             	mov    0xc(%ebp),%edi
f0102e60:	03 7d 10             	add    0x10(%ebp),%edi
f0102e63:	81 c7 ff 0f 00 00    	add    $0xfff,%edi
f0102e69:	81 e7 00 f0 ff ff    	and    $0xfffff000,%edi
	for (i = (uint32_t)begin; i < end; i+=PGSIZE) {
f0102e6f:	eb 06                	jmp    f0102e77 <user_mem_check+0x33>
f0102e71:	81 c3 00 10 00 00    	add    $0x1000,%ebx
f0102e77:	39 fb                	cmp    %edi,%ebx
f0102e79:	73 46                	jae    f0102ec1 <user_mem_check+0x7d>
		pte_t *pte = pgdir_walk(env->env_pgdir, (void*)i, 0);//页表项pte
f0102e7b:	83 ec 04             	sub    $0x4,%esp
f0102e7e:	6a 00                	push   $0x0
f0102e80:	53                   	push   %ebx
f0102e81:	8b 45 08             	mov    0x8(%ebp),%eax
f0102e84:	ff 70 60             	pushl  0x60(%eax)
f0102e87:	e8 ec e0 ff ff       	call   f0100f78 <pgdir_walk>
		if ((i>=ULIM) || !pte || !(*pte & PTE_P) || ((*pte & perm) != perm)) {	//ULIM是用户空间的内存上界[不能访问kernel memmory]、pte要存在且有效、pte对应的权限*pte&perm==perm存在
f0102e8c:	83 c4 10             	add    $0x10,%esp
f0102e8f:	81 fb ff ff 7f ef    	cmp    $0xef7fffff,%ebx
f0102e95:	77 10                	ja     f0102ea7 <user_mem_check+0x63>
f0102e97:	85 c0                	test   %eax,%eax
f0102e99:	74 0c                	je     f0102ea7 <user_mem_check+0x63>
f0102e9b:	8b 00                	mov    (%eax),%eax
f0102e9d:	a8 01                	test   $0x1,%al
f0102e9f:	74 06                	je     f0102ea7 <user_mem_check+0x63>
f0102ea1:	21 f0                	and    %esi,%eax
f0102ea3:	39 c6                	cmp    %eax,%esi
f0102ea5:	74 ca                	je     f0102e71 <user_mem_check+0x2d>
			user_mem_check_addr = (i<(uint32_t)va?(uint32_t)va:i);	//如果有误，就设置第一个有误的虚拟地址user_mem_check_addr
f0102ea7:	3b 5d 0c             	cmp    0xc(%ebp),%ebx
f0102eaa:	0f 42 5d 0c          	cmovb  0xc(%ebp),%ebx
f0102eae:	89 1d 3c 72 21 f0    	mov    %ebx,0xf021723c
			return -E_FAULT;
f0102eb4:	b8 fa ff ff ff       	mov    $0xfffffffa,%eax
}
f0102eb9:	8d 65 f4             	lea    -0xc(%ebp),%esp
f0102ebc:	5b                   	pop    %ebx
f0102ebd:	5e                   	pop    %esi
f0102ebe:	5f                   	pop    %edi
f0102ebf:	5d                   	pop    %ebp
f0102ec0:	c3                   	ret    
	return 0;
f0102ec1:	b8 00 00 00 00       	mov    $0x0,%eax
f0102ec6:	eb f1                	jmp    f0102eb9 <user_mem_check+0x75>

f0102ec8 <user_mem_assert>:
{
f0102ec8:	f3 0f 1e fb          	endbr32 
f0102ecc:	55                   	push   %ebp
f0102ecd:	89 e5                	mov    %esp,%ebp
f0102ecf:	53                   	push   %ebx
f0102ed0:	83 ec 04             	sub    $0x4,%esp
f0102ed3:	8b 5d 08             	mov    0x8(%ebp),%ebx
	if (user_mem_check(env, va, len, perm | PTE_U) < 0) {
f0102ed6:	8b 45 14             	mov    0x14(%ebp),%eax
f0102ed9:	83 c8 04             	or     $0x4,%eax
f0102edc:	50                   	push   %eax
f0102edd:	ff 75 10             	pushl  0x10(%ebp)
f0102ee0:	ff 75 0c             	pushl  0xc(%ebp)
f0102ee3:	53                   	push   %ebx
f0102ee4:	e8 5b ff ff ff       	call   f0102e44 <user_mem_check>
f0102ee9:	83 c4 10             	add    $0x10,%esp
f0102eec:	85 c0                	test   %eax,%eax
f0102eee:	78 05                	js     f0102ef5 <user_mem_assert+0x2d>
}
f0102ef0:	8b 5d fc             	mov    -0x4(%ebp),%ebx
f0102ef3:	c9                   	leave  
f0102ef4:	c3                   	ret    
		cprintf("[%08x] user_mem_check assertion failure for "
f0102ef5:	83 ec 04             	sub    $0x4,%esp
f0102ef8:	ff 35 3c 72 21 f0    	pushl  0xf021723c
f0102efe:	ff 73 48             	pushl  0x48(%ebx)
f0102f01:	68 ec 73 10 f0       	push   $0xf01073ec
f0102f06:	e8 d2 08 00 00       	call   f01037dd <cprintf>
		env_destroy(env);	// may not return
f0102f0b:	89 1c 24             	mov    %ebx,(%esp)
f0102f0e:	e8 d1 05 00 00       	call   f01034e4 <env_destroy>
f0102f13:	83 c4 10             	add    $0x10,%esp
}
f0102f16:	eb d8                	jmp    f0102ef0 <user_mem_assert+0x28>

f0102f18 <region_alloc>:
// Pages should be writable by user and kernel.
// Panic if any allocation attempt fails.
//
static void
region_alloc(struct Env *e, void *va, size_t len)
{
f0102f18:	55                   	push   %ebp
f0102f19:	89 e5                	mov    %esp,%ebp
f0102f1b:	57                   	push   %edi
f0102f1c:	56                   	push   %esi
f0102f1d:	53                   	push   %ebx
f0102f1e:	83 ec 0c             	sub    $0xc,%esp
f0102f21:	89 c7                	mov    %eax,%edi
	// Hint: It is easier to use region_alloc if the caller can pass
	//   'va' and 'len' values that are not page-aligned.
	//   You should round va down, and round (va + len) up.
	//   (Watch out for corner-cases!)
	//先对齐。
	void*begin=ROUNDDOWN(va,PGSIZE),*end=ROUNDUP(va+len,PGSIZE);
f0102f23:	89 d3                	mov    %edx,%ebx
f0102f25:	81 e3 00 f0 ff ff    	and    $0xfffff000,%ebx
f0102f2b:	8d b4 0a ff 0f 00 00 	lea    0xfff(%edx,%ecx,1),%esi
f0102f32:	81 e6 00 f0 ff ff    	and    $0xfffff000,%esi
	while(begin<end){
f0102f38:	39 f3                	cmp    %esi,%ebx
f0102f3a:	73 3f                	jae    f0102f7b <region_alloc+0x63>
		//分配一个物理页。
		 
		 struct PageInfo* pg=page_alloc(0);
f0102f3c:	83 ec 0c             	sub    $0xc,%esp
f0102f3f:	6a 00                	push   $0x0
f0102f41:	e8 4d df ff ff       	call   f0100e93 <page_alloc>
		 if(!pg){
f0102f46:	83 c4 10             	add    $0x10,%esp
f0102f49:	85 c0                	test   %eax,%eax
f0102f4b:	74 17                	je     f0102f64 <region_alloc+0x4c>
			 panic("region_alloc failed\n");
		 }
		//修改e->env_pgdir，建立线性地址begin到物理页pg的映射关系
		page_insert(e->env_pgdir, pg, begin, PTE_W | PTE_U);   
f0102f4d:	6a 06                	push   $0x6
f0102f4f:	53                   	push   %ebx
f0102f50:	50                   	push   %eax
f0102f51:	ff 77 60             	pushl  0x60(%edi)
f0102f54:	e8 00 e2 ff ff       	call   f0101159 <page_insert>
		begin += PGSIZE;    //更新线性地址
f0102f59:	81 c3 00 10 00 00    	add    $0x1000,%ebx
f0102f5f:	83 c4 10             	add    $0x10,%esp
f0102f62:	eb d4                	jmp    f0102f38 <region_alloc+0x20>
			 panic("region_alloc failed\n");
f0102f64:	83 ec 04             	sub    $0x4,%esp
f0102f67:	68 37 77 10 f0       	push   $0xf0107737
f0102f6c:	68 34 01 00 00       	push   $0x134
f0102f71:	68 4c 77 10 f0       	push   $0xf010774c
f0102f76:	e8 c5 d0 ff ff       	call   f0100040 <_panic>
	}
}
f0102f7b:	8d 65 f4             	lea    -0xc(%ebp),%esp
f0102f7e:	5b                   	pop    %ebx
f0102f7f:	5e                   	pop    %esi
f0102f80:	5f                   	pop    %edi
f0102f81:	5d                   	pop    %ebp
f0102f82:	c3                   	ret    

f0102f83 <envid2env>:
{
f0102f83:	f3 0f 1e fb          	endbr32 
f0102f87:	55                   	push   %ebp
f0102f88:	89 e5                	mov    %esp,%ebp
f0102f8a:	56                   	push   %esi
f0102f8b:	53                   	push   %ebx
f0102f8c:	8b 75 08             	mov    0x8(%ebp),%esi
f0102f8f:	8b 45 10             	mov    0x10(%ebp),%eax
	if (envid == 0) {
f0102f92:	85 f6                	test   %esi,%esi
f0102f94:	74 2e                	je     f0102fc4 <envid2env+0x41>
	e = &envs[ENVX(envid)];
f0102f96:	89 f3                	mov    %esi,%ebx
f0102f98:	81 e3 ff 03 00 00    	and    $0x3ff,%ebx
f0102f9e:	6b db 7c             	imul   $0x7c,%ebx,%ebx
f0102fa1:	03 1d 48 72 21 f0    	add    0xf0217248,%ebx
	if (e->env_status == ENV_FREE || e->env_id != envid) {
f0102fa7:	83 7b 54 00          	cmpl   $0x0,0x54(%ebx)
f0102fab:	74 2e                	je     f0102fdb <envid2env+0x58>
f0102fad:	39 73 48             	cmp    %esi,0x48(%ebx)
f0102fb0:	75 29                	jne    f0102fdb <envid2env+0x58>
	if (checkperm && e != curenv && e->env_parent_id != curenv->env_id) {
f0102fb2:	84 c0                	test   %al,%al
f0102fb4:	75 35                	jne    f0102feb <envid2env+0x68>
	*env_store = e;
f0102fb6:	8b 45 0c             	mov    0xc(%ebp),%eax
f0102fb9:	89 18                	mov    %ebx,(%eax)
	return 0;
f0102fbb:	b8 00 00 00 00       	mov    $0x0,%eax
}
f0102fc0:	5b                   	pop    %ebx
f0102fc1:	5e                   	pop    %esi
f0102fc2:	5d                   	pop    %ebp
f0102fc3:	c3                   	ret    
		*env_store = curenv;
f0102fc4:	e8 41 2f 00 00       	call   f0105f0a <cpunum>
f0102fc9:	6b c0 74             	imul   $0x74,%eax,%eax
f0102fcc:	8b 80 28 80 21 f0    	mov    -0xfde7fd8(%eax),%eax
f0102fd2:	8b 55 0c             	mov    0xc(%ebp),%edx
f0102fd5:	89 02                	mov    %eax,(%edx)
		return 0;
f0102fd7:	89 f0                	mov    %esi,%eax
f0102fd9:	eb e5                	jmp    f0102fc0 <envid2env+0x3d>
		*env_store = 0;
f0102fdb:	8b 45 0c             	mov    0xc(%ebp),%eax
f0102fde:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
		return -E_BAD_ENV;
f0102fe4:	b8 fe ff ff ff       	mov    $0xfffffffe,%eax
f0102fe9:	eb d5                	jmp    f0102fc0 <envid2env+0x3d>
	if (checkperm && e != curenv && e->env_parent_id != curenv->env_id) {
f0102feb:	e8 1a 2f 00 00       	call   f0105f0a <cpunum>
f0102ff0:	6b c0 74             	imul   $0x74,%eax,%eax
f0102ff3:	39 98 28 80 21 f0    	cmp    %ebx,-0xfde7fd8(%eax)
f0102ff9:	74 bb                	je     f0102fb6 <envid2env+0x33>
f0102ffb:	8b 73 4c             	mov    0x4c(%ebx),%esi
f0102ffe:	e8 07 2f 00 00       	call   f0105f0a <cpunum>
f0103003:	6b c0 74             	imul   $0x74,%eax,%eax
f0103006:	8b 80 28 80 21 f0    	mov    -0xfde7fd8(%eax),%eax
f010300c:	3b 70 48             	cmp    0x48(%eax),%esi
f010300f:	74 a5                	je     f0102fb6 <envid2env+0x33>
		*env_store = 0;
f0103011:	8b 45 0c             	mov    0xc(%ebp),%eax
f0103014:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
		return -E_BAD_ENV;
f010301a:	b8 fe ff ff ff       	mov    $0xfffffffe,%eax
f010301f:	eb 9f                	jmp    f0102fc0 <envid2env+0x3d>

f0103021 <env_init_percpu>:
{
f0103021:	f3 0f 1e fb          	endbr32 
	asm volatile("lgdt (%0)" : : "r" (p));
f0103025:	b8 20 33 12 f0       	mov    $0xf0123320,%eax
f010302a:	0f 01 10             	lgdtl  (%eax)
	asm volatile("movw %%ax,%%gs" : : "a" (GD_UD|3));
f010302d:	b8 23 00 00 00       	mov    $0x23,%eax
f0103032:	8e e8                	mov    %eax,%gs
	asm volatile("movw %%ax,%%fs" : : "a" (GD_UD|3));
f0103034:	8e e0                	mov    %eax,%fs
	asm volatile("movw %%ax,%%es" : : "a" (GD_KD));
f0103036:	b8 10 00 00 00       	mov    $0x10,%eax
f010303b:	8e c0                	mov    %eax,%es
	asm volatile("movw %%ax,%%ds" : : "a" (GD_KD));
f010303d:	8e d8                	mov    %eax,%ds
	asm volatile("movw %%ax,%%ss" : : "a" (GD_KD));
f010303f:	8e d0                	mov    %eax,%ss
	asm volatile("ljmp %0,$1f\n 1:\n" : : "i" (GD_KT));
f0103041:	ea 48 30 10 f0 08 00 	ljmp   $0x8,$0xf0103048
	asm volatile("lldt %0" : : "r" (sel));
f0103048:	b8 00 00 00 00       	mov    $0x0,%eax
f010304d:	0f 00 d0             	lldt   %ax
}
f0103050:	c3                   	ret    

f0103051 <env_init>:
{
f0103051:	f3 0f 1e fb          	endbr32 
f0103055:	55                   	push   %ebp
f0103056:	89 e5                	mov    %esp,%ebp
f0103058:	56                   	push   %esi
f0103059:	53                   	push   %ebx
		envs[i].env_id=0;
f010305a:	8b 35 48 72 21 f0    	mov    0xf0217248,%esi
f0103060:	8d 86 84 ef 01 00    	lea    0x1ef84(%esi),%eax
f0103066:	89 f3                	mov    %esi,%ebx
f0103068:	ba 00 00 00 00       	mov    $0x0,%edx
f010306d:	89 d1                	mov    %edx,%ecx
f010306f:	89 c2                	mov    %eax,%edx
f0103071:	c7 40 48 00 00 00 00 	movl   $0x0,0x48(%eax)
		envs[i].env_link=env_free_list;
f0103078:	89 48 44             	mov    %ecx,0x44(%eax)
f010307b:	83 e8 7c             	sub    $0x7c,%eax
	for(int i=NENV-1;i>=0;--i){
f010307e:	39 da                	cmp    %ebx,%edx
f0103080:	75 eb                	jne    f010306d <env_init+0x1c>
f0103082:	89 35 4c 72 21 f0    	mov    %esi,0xf021724c
	env_init_percpu();
f0103088:	e8 94 ff ff ff       	call   f0103021 <env_init_percpu>
}
f010308d:	5b                   	pop    %ebx
f010308e:	5e                   	pop    %esi
f010308f:	5d                   	pop    %ebp
f0103090:	c3                   	ret    

f0103091 <env_alloc>:
{
f0103091:	f3 0f 1e fb          	endbr32 
f0103095:	55                   	push   %ebp
f0103096:	89 e5                	mov    %esp,%ebp
f0103098:	53                   	push   %ebx
f0103099:	83 ec 04             	sub    $0x4,%esp
	if (!(e = env_free_list))
f010309c:	8b 1d 4c 72 21 f0    	mov    0xf021724c,%ebx
f01030a2:	85 db                	test   %ebx,%ebx
f01030a4:	0f 84 3b 01 00 00    	je     f01031e5 <env_alloc+0x154>
	if (!(p = page_alloc(ALLOC_ZERO)))
f01030aa:	83 ec 0c             	sub    $0xc,%esp
f01030ad:	6a 01                	push   $0x1
f01030af:	e8 df dd ff ff       	call   f0100e93 <page_alloc>
f01030b4:	83 c4 10             	add    $0x10,%esp
f01030b7:	85 c0                	test   %eax,%eax
f01030b9:	0f 84 2d 01 00 00    	je     f01031ec <env_alloc+0x15b>
	p->pp_ref++;
f01030bf:	66 83 40 04 01       	addw   $0x1,0x4(%eax)
	return (pp - pages) << PGSHIFT;
f01030c4:	2b 05 90 7e 21 f0    	sub    0xf0217e90,%eax
f01030ca:	c1 f8 03             	sar    $0x3,%eax
f01030cd:	89 c2                	mov    %eax,%edx
f01030cf:	c1 e2 0c             	shl    $0xc,%edx
	if (PGNUM(pa) >= npages)
f01030d2:	25 ff ff 0f 00       	and    $0xfffff,%eax
f01030d7:	3b 05 88 7e 21 f0    	cmp    0xf0217e88,%eax
f01030dd:	0f 83 db 00 00 00    	jae    f01031be <env_alloc+0x12d>
	return (void *)(pa + KERNBASE);
f01030e3:	8d 82 00 00 00 f0    	lea    -0x10000000(%edx),%eax
	e->env_pgdir=(pde_t *)page2kva(p);
f01030e9:	89 43 60             	mov    %eax,0x60(%ebx)
	memcpy(e->env_pgdir,kern_pgdir,PGSIZE);
f01030ec:	83 ec 04             	sub    $0x4,%esp
f01030ef:	68 00 10 00 00       	push   $0x1000
f01030f4:	ff 35 8c 7e 21 f0    	pushl  0xf0217e8c
f01030fa:	50                   	push   %eax
f01030fb:	e8 9c 28 00 00       	call   f010599c <memcpy>
	e->env_pgdir[PDX(UVPT)] = PADDR(e->env_pgdir) | PTE_P | PTE_U;
f0103100:	8b 43 60             	mov    0x60(%ebx),%eax
	if ((uint32_t)kva < KERNBASE)
f0103103:	83 c4 10             	add    $0x10,%esp
f0103106:	3d ff ff ff ef       	cmp    $0xefffffff,%eax
f010310b:	0f 86 bf 00 00 00    	jbe    f01031d0 <env_alloc+0x13f>
	return (physaddr_t)kva - KERNBASE;
f0103111:	8d 90 00 00 00 10    	lea    0x10000000(%eax),%edx
f0103117:	83 ca 05             	or     $0x5,%edx
f010311a:	89 90 f4 0e 00 00    	mov    %edx,0xef4(%eax)
	generation = (e->env_id + (1 << ENVGENSHIFT)) & ~(NENV - 1);
f0103120:	8b 43 48             	mov    0x48(%ebx),%eax
f0103123:	05 00 10 00 00       	add    $0x1000,%eax
		generation = 1 << ENVGENSHIFT;
f0103128:	25 00 fc ff ff       	and    $0xfffffc00,%eax
f010312d:	ba 00 10 00 00       	mov    $0x1000,%edx
f0103132:	0f 4e c2             	cmovle %edx,%eax
	e->env_id = generation | (e - envs);
f0103135:	89 da                	mov    %ebx,%edx
f0103137:	2b 15 48 72 21 f0    	sub    0xf0217248,%edx
f010313d:	c1 fa 02             	sar    $0x2,%edx
f0103140:	69 d2 df 7b ef bd    	imul   $0xbdef7bdf,%edx,%edx
f0103146:	09 d0                	or     %edx,%eax
f0103148:	89 43 48             	mov    %eax,0x48(%ebx)
	e->env_parent_id = parent_id;
f010314b:	8b 45 0c             	mov    0xc(%ebp),%eax
f010314e:	89 43 4c             	mov    %eax,0x4c(%ebx)
	e->env_type = ENV_TYPE_USER;
f0103151:	c7 43 50 00 00 00 00 	movl   $0x0,0x50(%ebx)
	e->env_status = ENV_RUNNABLE;
f0103158:	c7 43 54 02 00 00 00 	movl   $0x2,0x54(%ebx)
	e->env_runs = 0;
f010315f:	c7 43 58 00 00 00 00 	movl   $0x0,0x58(%ebx)
	memset(&e->env_tf, 0, sizeof(e->env_tf));
f0103166:	83 ec 04             	sub    $0x4,%esp
f0103169:	6a 44                	push   $0x44
f010316b:	6a 00                	push   $0x0
f010316d:	53                   	push   %ebx
f010316e:	e8 77 27 00 00       	call   f01058ea <memset>
	e->env_tf.tf_ds = GD_UD | 3;
f0103173:	66 c7 43 24 23 00    	movw   $0x23,0x24(%ebx)
	e->env_tf.tf_es = GD_UD | 3;
f0103179:	66 c7 43 20 23 00    	movw   $0x23,0x20(%ebx)
	e->env_tf.tf_ss = GD_UD | 3;
f010317f:	66 c7 43 40 23 00    	movw   $0x23,0x40(%ebx)
	e->env_tf.tf_esp = USTACKTOP;
f0103185:	c7 43 3c 00 e0 bf ee 	movl   $0xeebfe000,0x3c(%ebx)
	e->env_tf.tf_cs = GD_UT | 3;
f010318c:	66 c7 43 34 1b 00    	movw   $0x1b,0x34(%ebx)
	 e->env_tf.tf_eflags |= FL_IF;
f0103192:	81 4b 38 00 02 00 00 	orl    $0x200,0x38(%ebx)
	e->env_pgfault_upcall = 0;
f0103199:	c7 43 64 00 00 00 00 	movl   $0x0,0x64(%ebx)
	e->env_ipc_recving = 0;
f01031a0:	c6 43 68 00          	movb   $0x0,0x68(%ebx)
	env_free_list = e->env_link;
f01031a4:	8b 43 44             	mov    0x44(%ebx),%eax
f01031a7:	a3 4c 72 21 f0       	mov    %eax,0xf021724c
	*newenv_store = e;
f01031ac:	8b 45 08             	mov    0x8(%ebp),%eax
f01031af:	89 18                	mov    %ebx,(%eax)
	return 0;
f01031b1:	83 c4 10             	add    $0x10,%esp
f01031b4:	b8 00 00 00 00       	mov    $0x0,%eax
}
f01031b9:	8b 5d fc             	mov    -0x4(%ebp),%ebx
f01031bc:	c9                   	leave  
f01031bd:	c3                   	ret    
		_panic(file, line, "KADDR called with invalid pa %08lx", pa);
f01031be:	52                   	push   %edx
f01031bf:	68 a4 65 10 f0       	push   $0xf01065a4
f01031c4:	6a 58                	push   $0x58
f01031c6:	68 2d 74 10 f0       	push   $0xf010742d
f01031cb:	e8 70 ce ff ff       	call   f0100040 <_panic>
		_panic(file, line, "PADDR called with invalid kva %08lx", kva);
f01031d0:	50                   	push   %eax
f01031d1:	68 c8 65 10 f0       	push   $0xf01065c8
f01031d6:	68 ce 00 00 00       	push   $0xce
f01031db:	68 4c 77 10 f0       	push   $0xf010774c
f01031e0:	e8 5b ce ff ff       	call   f0100040 <_panic>
		return -E_NO_FREE_ENV;
f01031e5:	b8 fb ff ff ff       	mov    $0xfffffffb,%eax
f01031ea:	eb cd                	jmp    f01031b9 <env_alloc+0x128>
		return -E_NO_MEM;
f01031ec:	b8 fc ff ff ff       	mov    $0xfffffffc,%eax
f01031f1:	eb c6                	jmp    f01031b9 <env_alloc+0x128>

f01031f3 <env_create>:
// before running the first user-mode environment.
// The new env's parent ID is set to 0.
//
void
env_create(uint8_t *binary, enum EnvType type)
{
f01031f3:	f3 0f 1e fb          	endbr32 
f01031f7:	55                   	push   %ebp
f01031f8:	89 e5                	mov    %esp,%ebp
f01031fa:	57                   	push   %edi
f01031fb:	56                   	push   %esi
f01031fc:	53                   	push   %ebx
f01031fd:	83 ec 34             	sub    $0x34,%esp
f0103200:	8b 75 08             	mov    0x8(%ebp),%esi


	
	struct Env*e;
	//期望拿到一个env描述符
	int result=env_alloc(&e,0);
f0103203:	6a 00                	push   $0x0
f0103205:	8d 45 e4             	lea    -0x1c(%ebp),%eax
f0103208:	50                   	push   %eax
f0103209:	e8 83 fe ff ff       	call   f0103091 <env_alloc>
	if(result!=0){
f010320e:	83 c4 10             	add    $0x10,%esp
f0103211:	85 c0                	test   %eax,%eax
f0103213:	75 3e                	jne    f0103253 <env_create+0x60>
       panic("create env failed\n");
	}
	if(type==ENV_TYPE_FS){
f0103215:	83 7d 0c 01          	cmpl   $0x1,0xc(%ebp)
f0103219:	74 4f                	je     f010326a <env_create+0x77>
		e->env_tf.tf_eflags|=FL_IOPL_MASK;
	}
	//载入程序
	load_icode(e,binary);
f010321b:	8b 7d e4             	mov    -0x1c(%ebp),%edi
	if(ELFHEADER->e_magic!=ELF_MAGIC)
f010321e:	81 3e 7f 45 4c 46    	cmpl   $0x464c457f,(%esi)
f0103224:	75 50                	jne    f0103276 <env_create+0x83>
	ph = (struct Proghdr *) ((uint8_t *) ELFHEADER + ELFHEADER->e_phoff);
f0103226:	8b 5e 1c             	mov    0x1c(%esi),%ebx
	ph_num = ELFHEADER->e_phnum;
f0103229:	0f b7 46 2c          	movzwl 0x2c(%esi),%eax
	lcr3(PADDR(e->env_pgdir));
f010322d:	8b 57 60             	mov    0x60(%edi),%edx
	if ((uint32_t)kva < KERNBASE)
f0103230:	81 fa ff ff ff ef    	cmp    $0xefffffff,%edx
f0103236:	76 55                	jbe    f010328d <env_create+0x9a>
	return (physaddr_t)kva - KERNBASE;
f0103238:	81 c2 00 00 00 10    	add    $0x10000000,%edx
	asm volatile("movl %0,%%cr3" : : "r" (val));
f010323e:	0f 22 da             	mov    %edx,%cr3
f0103241:	01 f3                	add    %esi,%ebx
f0103243:	0f b7 c0             	movzwl %ax,%eax
f0103246:	c1 e0 05             	shl    $0x5,%eax
f0103249:	01 d8                	add    %ebx,%eax
f010324b:	89 45 d4             	mov    %eax,-0x2c(%ebp)
	for (int i = 0; i < ph_num; i++) {
f010324e:	e9 86 00 00 00       	jmp    f01032d9 <env_create+0xe6>
       panic("create env failed\n");
f0103253:	83 ec 04             	sub    $0x4,%esp
f0103256:	68 57 77 10 f0       	push   $0xf0107757
f010325b:	68 a5 01 00 00       	push   $0x1a5
f0103260:	68 4c 77 10 f0       	push   $0xf010774c
f0103265:	e8 d6 cd ff ff       	call   f0100040 <_panic>
		e->env_tf.tf_eflags|=FL_IOPL_MASK;
f010326a:	8b 45 e4             	mov    -0x1c(%ebp),%eax
f010326d:	81 48 38 00 30 00 00 	orl    $0x3000,0x38(%eax)
f0103274:	eb a5                	jmp    f010321b <env_create+0x28>
		panic("binary is not ELF format\n");	
f0103276:	83 ec 04             	sub    $0x4,%esp
f0103279:	68 6a 77 10 f0       	push   $0xf010776a
f010327e:	68 7b 01 00 00       	push   $0x17b
f0103283:	68 4c 77 10 f0       	push   $0xf010774c
f0103288:	e8 b3 cd ff ff       	call   f0100040 <_panic>
		_panic(file, line, "PADDR called with invalid kva %08lx", kva);
f010328d:	52                   	push   %edx
f010328e:	68 c8 65 10 f0       	push   $0xf01065c8
f0103293:	68 7f 01 00 00       	push   $0x17f
f0103298:	68 4c 77 10 f0       	push   $0xf010774c
f010329d:	e8 9e cd ff ff       	call   f0100040 <_panic>
			region_alloc(e, (void *)ph[i].p_va, ph[i].p_memsz);
f01032a2:	8b 4b 14             	mov    0x14(%ebx),%ecx
f01032a5:	8b 53 08             	mov    0x8(%ebx),%edx
f01032a8:	89 f8                	mov    %edi,%eax
f01032aa:	e8 69 fc ff ff       	call   f0102f18 <region_alloc>
			memset((void *)ph[i].p_va, 0, ph[i].p_memsz);		//因为这里需要访问刚分配的内存，所以之前需要切换页目录
f01032af:	83 ec 04             	sub    $0x4,%esp
f01032b2:	ff 73 14             	pushl  0x14(%ebx)
f01032b5:	6a 00                	push   $0x0
f01032b7:	ff 73 08             	pushl  0x8(%ebx)
f01032ba:	e8 2b 26 00 00       	call   f01058ea <memset>
			memcpy((void *)ph[i].p_va, binary + ph[i].p_offset, ph[i].p_filesz); //应该有如下关系：ph->p_filesz <= ph->p_memsz。搜索BSS段
f01032bf:	83 c4 0c             	add    $0xc,%esp
f01032c2:	ff 73 10             	pushl  0x10(%ebx)
f01032c5:	89 f0                	mov    %esi,%eax
f01032c7:	03 43 04             	add    0x4(%ebx),%eax
f01032ca:	50                   	push   %eax
f01032cb:	ff 73 08             	pushl  0x8(%ebx)
f01032ce:	e8 c9 26 00 00       	call   f010599c <memcpy>
f01032d3:	83 c4 10             	add    $0x10,%esp
f01032d6:	83 c3 20             	add    $0x20,%ebx
	for (int i = 0; i < ph_num; i++) {
f01032d9:	3b 5d d4             	cmp    -0x2c(%ebp),%ebx
f01032dc:	74 07                	je     f01032e5 <env_create+0xf2>
		if (ph[i].p_type == ELF_PROG_LOAD) {		//只加载LOAD类型的Segment
f01032de:	83 3b 01             	cmpl   $0x1,(%ebx)
f01032e1:	75 f3                	jne    f01032d6 <env_create+0xe3>
f01032e3:	eb bd                	jmp    f01032a2 <env_create+0xaf>
	lcr3(PADDR(kern_pgdir));
f01032e5:	a1 8c 7e 21 f0       	mov    0xf0217e8c,%eax
	if ((uint32_t)kva < KERNBASE)
f01032ea:	3d ff ff ff ef       	cmp    $0xefffffff,%eax
f01032ef:	76 30                	jbe    f0103321 <env_create+0x12e>
	return (physaddr_t)kva - KERNBASE;
f01032f1:	05 00 00 00 10       	add    $0x10000000,%eax
f01032f6:	0f 22 d8             	mov    %eax,%cr3
	e->env_tf.tf_eip = ELFHEADER->e_entry;
f01032f9:	8b 46 18             	mov    0x18(%esi),%eax
f01032fc:	89 47 30             	mov    %eax,0x30(%edi)
	region_alloc(e, (void *) (USTACKTOP - PGSIZE), PGSIZE);
f01032ff:	b9 00 10 00 00       	mov    $0x1000,%ecx
f0103304:	ba 00 d0 bf ee       	mov    $0xeebfd000,%edx
f0103309:	89 f8                	mov    %edi,%eax
f010330b:	e8 08 fc ff ff       	call   f0102f18 <region_alloc>
	e->env_type=type;
f0103310:	8b 45 e4             	mov    -0x1c(%ebp),%eax
f0103313:	8b 4d 0c             	mov    0xc(%ebp),%ecx
f0103316:	89 48 50             	mov    %ecx,0x50(%eax)

}
f0103319:	8d 65 f4             	lea    -0xc(%ebp),%esp
f010331c:	5b                   	pop    %ebx
f010331d:	5e                   	pop    %esi
f010331e:	5f                   	pop    %edi
f010331f:	5d                   	pop    %ebp
f0103320:	c3                   	ret    
		_panic(file, line, "PADDR called with invalid kva %08lx", kva);
f0103321:	50                   	push   %eax
f0103322:	68 c8 65 10 f0       	push   $0xf01065c8
f0103327:	68 8a 01 00 00       	push   $0x18a
f010332c:	68 4c 77 10 f0       	push   $0xf010774c
f0103331:	e8 0a cd ff ff       	call   f0100040 <_panic>

f0103336 <env_free>:
//
// Frees env e and all memory it uses.
//
void
env_free(struct Env *e)
{
f0103336:	f3 0f 1e fb          	endbr32 
f010333a:	55                   	push   %ebp
f010333b:	89 e5                	mov    %esp,%ebp
f010333d:	57                   	push   %edi
f010333e:	56                   	push   %esi
f010333f:	53                   	push   %ebx
f0103340:	83 ec 1c             	sub    $0x1c,%esp
f0103343:	8b 7d 08             	mov    0x8(%ebp),%edi
	physaddr_t pa;

	// If freeing the current environment, switch to kern_pgdir
	// before freeing the page directory, just in case the page
	// gets reused.
	if (e == curenv)
f0103346:	e8 bf 2b 00 00       	call   f0105f0a <cpunum>
f010334b:	6b c0 74             	imul   $0x74,%eax,%eax
f010334e:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
f0103355:	39 b8 28 80 21 f0    	cmp    %edi,-0xfde7fd8(%eax)
f010335b:	0f 85 b3 00 00 00    	jne    f0103414 <env_free+0xde>
		lcr3(PADDR(kern_pgdir));
f0103361:	a1 8c 7e 21 f0       	mov    0xf0217e8c,%eax
	if ((uint32_t)kva < KERNBASE)
f0103366:	3d ff ff ff ef       	cmp    $0xefffffff,%eax
f010336b:	76 14                	jbe    f0103381 <env_free+0x4b>
	return (physaddr_t)kva - KERNBASE;
f010336d:	05 00 00 00 10       	add    $0x10000000,%eax
f0103372:	0f 22 d8             	mov    %eax,%cr3
}
f0103375:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
f010337c:	e9 93 00 00 00       	jmp    f0103414 <env_free+0xde>
		_panic(file, line, "PADDR called with invalid kva %08lx", kva);
f0103381:	50                   	push   %eax
f0103382:	68 c8 65 10 f0       	push   $0xf01065c8
f0103387:	68 be 01 00 00       	push   $0x1be
f010338c:	68 4c 77 10 f0       	push   $0xf010774c
f0103391:	e8 aa cc ff ff       	call   f0100040 <_panic>
		_panic(file, line, "KADDR called with invalid pa %08lx", pa);
f0103396:	56                   	push   %esi
f0103397:	68 a4 65 10 f0       	push   $0xf01065a4
f010339c:	68 cd 01 00 00       	push   $0x1cd
f01033a1:	68 4c 77 10 f0       	push   $0xf010774c
f01033a6:	e8 95 cc ff ff       	call   f0100040 <_panic>
		pt = (pte_t*) KADDR(pa);

		// unmap all PTEs in this page table
		for (pteno = 0; pteno <= PTX(~0); pteno++) {
			if (pt[pteno] & PTE_P)
				page_remove(e->env_pgdir, PGADDR(pdeno, pteno, 0));
f01033ab:	83 ec 08             	sub    $0x8,%esp
f01033ae:	89 d8                	mov    %ebx,%eax
f01033b0:	c1 e0 0c             	shl    $0xc,%eax
f01033b3:	0b 45 e4             	or     -0x1c(%ebp),%eax
f01033b6:	50                   	push   %eax
f01033b7:	ff 77 60             	pushl  0x60(%edi)
f01033ba:	e8 50 dd ff ff       	call   f010110f <page_remove>
f01033bf:	83 c4 10             	add    $0x10,%esp
		for (pteno = 0; pteno <= PTX(~0); pteno++) {
f01033c2:	83 c3 01             	add    $0x1,%ebx
f01033c5:	83 c6 04             	add    $0x4,%esi
f01033c8:	81 fb 00 04 00 00    	cmp    $0x400,%ebx
f01033ce:	74 07                	je     f01033d7 <env_free+0xa1>
			if (pt[pteno] & PTE_P)
f01033d0:	f6 06 01             	testb  $0x1,(%esi)
f01033d3:	74 ed                	je     f01033c2 <env_free+0x8c>
f01033d5:	eb d4                	jmp    f01033ab <env_free+0x75>
		}

		// free the page table itself
		e->env_pgdir[pdeno] = 0;
f01033d7:	8b 47 60             	mov    0x60(%edi),%eax
f01033da:	8b 55 e0             	mov    -0x20(%ebp),%edx
f01033dd:	c7 04 10 00 00 00 00 	movl   $0x0,(%eax,%edx,1)
	if (PGNUM(pa) >= npages)
f01033e4:	8b 45 dc             	mov    -0x24(%ebp),%eax
f01033e7:	3b 05 88 7e 21 f0    	cmp    0xf0217e88,%eax
f01033ed:	73 65                	jae    f0103454 <env_free+0x11e>
		page_decref(pa2page(pa));
f01033ef:	83 ec 0c             	sub    $0xc,%esp
	return &pages[PGNUM(pa)];
f01033f2:	a1 90 7e 21 f0       	mov    0xf0217e90,%eax
f01033f7:	8b 55 dc             	mov    -0x24(%ebp),%edx
f01033fa:	8d 04 d0             	lea    (%eax,%edx,8),%eax
f01033fd:	50                   	push   %eax
f01033fe:	e8 48 db ff ff       	call   f0100f4b <page_decref>
f0103403:	83 c4 10             	add    $0x10,%esp
f0103406:	83 45 e0 04          	addl   $0x4,-0x20(%ebp)
f010340a:	8b 45 e0             	mov    -0x20(%ebp),%eax
	for (pdeno = 0; pdeno < PDX(UTOP); pdeno++) {
f010340d:	3d ec 0e 00 00       	cmp    $0xeec,%eax
f0103412:	74 54                	je     f0103468 <env_free+0x132>
		if (!(e->env_pgdir[pdeno] & PTE_P))
f0103414:	8b 47 60             	mov    0x60(%edi),%eax
f0103417:	8b 55 e0             	mov    -0x20(%ebp),%edx
f010341a:	8b 04 10             	mov    (%eax,%edx,1),%eax
f010341d:	a8 01                	test   $0x1,%al
f010341f:	74 e5                	je     f0103406 <env_free+0xd0>
		pa = PTE_ADDR(e->env_pgdir[pdeno]);
f0103421:	89 c6                	mov    %eax,%esi
f0103423:	81 e6 00 f0 ff ff    	and    $0xfffff000,%esi
	if (PGNUM(pa) >= npages)
f0103429:	c1 e8 0c             	shr    $0xc,%eax
f010342c:	89 45 dc             	mov    %eax,-0x24(%ebp)
f010342f:	39 05 88 7e 21 f0    	cmp    %eax,0xf0217e88
f0103435:	0f 86 5b ff ff ff    	jbe    f0103396 <env_free+0x60>
	return (void *)(pa + KERNBASE);
f010343b:	81 ee 00 00 00 10    	sub    $0x10000000,%esi
f0103441:	8b 45 e0             	mov    -0x20(%ebp),%eax
f0103444:	c1 e0 14             	shl    $0x14,%eax
f0103447:	89 45 e4             	mov    %eax,-0x1c(%ebp)
		for (pteno = 0; pteno <= PTX(~0); pteno++) {
f010344a:	bb 00 00 00 00       	mov    $0x0,%ebx
f010344f:	e9 7c ff ff ff       	jmp    f01033d0 <env_free+0x9a>
		panic("pa2page called with invalid pa");
f0103454:	83 ec 04             	sub    $0x4,%esp
f0103457:	68 b8 6b 10 f0       	push   $0xf0106bb8
f010345c:	6a 51                	push   $0x51
f010345e:	68 2d 74 10 f0       	push   $0xf010742d
f0103463:	e8 d8 cb ff ff       	call   f0100040 <_panic>
	}

	// free the page directory
	pa = PADDR(e->env_pgdir);
f0103468:	8b 47 60             	mov    0x60(%edi),%eax
	if ((uint32_t)kva < KERNBASE)
f010346b:	3d ff ff ff ef       	cmp    $0xefffffff,%eax
f0103470:	76 49                	jbe    f01034bb <env_free+0x185>
	e->env_pgdir = 0;
f0103472:	c7 47 60 00 00 00 00 	movl   $0x0,0x60(%edi)
	return (physaddr_t)kva - KERNBASE;
f0103479:	05 00 00 00 10       	add    $0x10000000,%eax
	if (PGNUM(pa) >= npages)
f010347e:	c1 e8 0c             	shr    $0xc,%eax
f0103481:	3b 05 88 7e 21 f0    	cmp    0xf0217e88,%eax
f0103487:	73 47                	jae    f01034d0 <env_free+0x19a>
	page_decref(pa2page(pa));
f0103489:	83 ec 0c             	sub    $0xc,%esp
	return &pages[PGNUM(pa)];
f010348c:	8b 15 90 7e 21 f0    	mov    0xf0217e90,%edx
f0103492:	8d 04 c2             	lea    (%edx,%eax,8),%eax
f0103495:	50                   	push   %eax
f0103496:	e8 b0 da ff ff       	call   f0100f4b <page_decref>

	// return the environment to the free list
	e->env_status = ENV_FREE;
f010349b:	c7 47 54 00 00 00 00 	movl   $0x0,0x54(%edi)
	e->env_link = env_free_list;
f01034a2:	a1 4c 72 21 f0       	mov    0xf021724c,%eax
f01034a7:	89 47 44             	mov    %eax,0x44(%edi)
	env_free_list = e;
f01034aa:	89 3d 4c 72 21 f0    	mov    %edi,0xf021724c
}
f01034b0:	83 c4 10             	add    $0x10,%esp
f01034b3:	8d 65 f4             	lea    -0xc(%ebp),%esp
f01034b6:	5b                   	pop    %ebx
f01034b7:	5e                   	pop    %esi
f01034b8:	5f                   	pop    %edi
f01034b9:	5d                   	pop    %ebp
f01034ba:	c3                   	ret    
		_panic(file, line, "PADDR called with invalid kva %08lx", kva);
f01034bb:	50                   	push   %eax
f01034bc:	68 c8 65 10 f0       	push   $0xf01065c8
f01034c1:	68 db 01 00 00       	push   $0x1db
f01034c6:	68 4c 77 10 f0       	push   $0xf010774c
f01034cb:	e8 70 cb ff ff       	call   f0100040 <_panic>
		panic("pa2page called with invalid pa");
f01034d0:	83 ec 04             	sub    $0x4,%esp
f01034d3:	68 b8 6b 10 f0       	push   $0xf0106bb8
f01034d8:	6a 51                	push   $0x51
f01034da:	68 2d 74 10 f0       	push   $0xf010742d
f01034df:	e8 5c cb ff ff       	call   f0100040 <_panic>

f01034e4 <env_destroy>:
// If e was the current env, then runs a new environment (and does not return
// to the caller).
//
void
env_destroy(struct Env *e)
{
f01034e4:	f3 0f 1e fb          	endbr32 
f01034e8:	55                   	push   %ebp
f01034e9:	89 e5                	mov    %esp,%ebp
f01034eb:	53                   	push   %ebx
f01034ec:	83 ec 04             	sub    $0x4,%esp
f01034ef:	8b 5d 08             	mov    0x8(%ebp),%ebx
	// If e is currently running on other CPUs, we change its state to
	// ENV_DYING. A zombie environment will be freed the next time
	// it traps to the kernel.
	if (e->env_status == ENV_RUNNING && curenv != e) {
f01034f2:	83 7b 54 03          	cmpl   $0x3,0x54(%ebx)
f01034f6:	74 21                	je     f0103519 <env_destroy+0x35>
		e->env_status = ENV_DYING;
		return;
	}

	env_free(e);
f01034f8:	83 ec 0c             	sub    $0xc,%esp
f01034fb:	53                   	push   %ebx
f01034fc:	e8 35 fe ff ff       	call   f0103336 <env_free>

	if (curenv == e) {
f0103501:	e8 04 2a 00 00       	call   f0105f0a <cpunum>
f0103506:	6b c0 74             	imul   $0x74,%eax,%eax
f0103509:	83 c4 10             	add    $0x10,%esp
f010350c:	39 98 28 80 21 f0    	cmp    %ebx,-0xfde7fd8(%eax)
f0103512:	74 1e                	je     f0103532 <env_destroy+0x4e>
		curenv = NULL;
		sched_yield();
	}
}
f0103514:	8b 5d fc             	mov    -0x4(%ebp),%ebx
f0103517:	c9                   	leave  
f0103518:	c3                   	ret    
	if (e->env_status == ENV_RUNNING && curenv != e) {
f0103519:	e8 ec 29 00 00       	call   f0105f0a <cpunum>
f010351e:	6b c0 74             	imul   $0x74,%eax,%eax
f0103521:	39 98 28 80 21 f0    	cmp    %ebx,-0xfde7fd8(%eax)
f0103527:	74 cf                	je     f01034f8 <env_destroy+0x14>
		e->env_status = ENV_DYING;
f0103529:	c7 43 54 01 00 00 00 	movl   $0x1,0x54(%ebx)
		return;
f0103530:	eb e2                	jmp    f0103514 <env_destroy+0x30>
		curenv = NULL;
f0103532:	e8 d3 29 00 00       	call   f0105f0a <cpunum>
f0103537:	6b c0 74             	imul   $0x74,%eax,%eax
f010353a:	c7 80 28 80 21 f0 00 	movl   $0x0,-0xfde7fd8(%eax)
f0103541:	00 00 00 
		sched_yield();
f0103544:	e8 a7 11 00 00       	call   f01046f0 <sched_yield>

f0103549 <env_pop_tf>:
//
// This function does not return.
//
void
env_pop_tf(struct Trapframe *tf)
{
f0103549:	f3 0f 1e fb          	endbr32 
f010354d:	55                   	push   %ebp
f010354e:	89 e5                	mov    %esp,%ebp
f0103550:	53                   	push   %ebx
f0103551:	83 ec 04             	sub    $0x4,%esp
	// Record the CPU we are running on for user-space debugging
	curenv->env_cpunum = cpunum();
f0103554:	e8 b1 29 00 00       	call   f0105f0a <cpunum>
f0103559:	6b c0 74             	imul   $0x74,%eax,%eax
f010355c:	8b 98 28 80 21 f0    	mov    -0xfde7fd8(%eax),%ebx
f0103562:	e8 a3 29 00 00       	call   f0105f0a <cpunum>
f0103567:	89 43 5c             	mov    %eax,0x5c(%ebx)

	asm volatile(
f010356a:	8b 65 08             	mov    0x8(%ebp),%esp
f010356d:	61                   	popa   
f010356e:	07                   	pop    %es
f010356f:	1f                   	pop    %ds
f0103570:	83 c4 08             	add    $0x8,%esp
f0103573:	cf                   	iret   
		"\tpopl %%es\n"
		"\tpopl %%ds\n"
		"\taddl $0x8,%%esp\n" /* skip tf_trapno and tf_errcode */
		"\tiret\n"
		: : "g" (tf) : "memory");
	panic("iret failed");  /* mostly to placate the compiler */
f0103574:	83 ec 04             	sub    $0x4,%esp
f0103577:	68 84 77 10 f0       	push   $0xf0107784
f010357c:	68 12 02 00 00       	push   $0x212
f0103581:	68 4c 77 10 f0       	push   $0xf010774c
f0103586:	e8 b5 ca ff ff       	call   f0100040 <_panic>

f010358b <env_run>:
//
// This function does not return.
//
void
env_run(struct Env *e)
{
f010358b:	f3 0f 1e fb          	endbr32 
f010358f:	55                   	push   %ebp
f0103590:	89 e5                	mov    %esp,%ebp
f0103592:	53                   	push   %ebx
f0103593:	83 ec 04             	sub    $0x4,%esp
f0103596:	8b 5d 08             	mov    0x8(%ebp),%ebx
	//	and make sure you have set the relevant parts of
	//	e->env_tf to sensible values.

	// LAB 3: Your code here.
	//首先切换env描述符状态
	if(curenv!=NULL&&curenv->env_status==ENV_RUNNING){
f0103599:	e8 6c 29 00 00       	call   f0105f0a <cpunum>
f010359e:	6b c0 74             	imul   $0x74,%eax,%eax
f01035a1:	83 b8 28 80 21 f0 00 	cmpl   $0x0,-0xfde7fd8(%eax)
f01035a8:	74 14                	je     f01035be <env_run+0x33>
f01035aa:	e8 5b 29 00 00       	call   f0105f0a <cpunum>
f01035af:	6b c0 74             	imul   $0x74,%eax,%eax
f01035b2:	8b 80 28 80 21 f0    	mov    -0xfde7fd8(%eax),%eax
f01035b8:	83 78 54 03          	cmpl   $0x3,0x54(%eax)
f01035bc:	74 50                	je     f010360e <env_run+0x83>
		curenv->env_status=ENV_RUNNABLE;
	}
	
	curenv=e;
f01035be:	e8 47 29 00 00       	call   f0105f0a <cpunum>
f01035c3:	6b c0 74             	imul   $0x74,%eax,%eax
f01035c6:	89 98 28 80 21 f0    	mov    %ebx,-0xfde7fd8(%eax)
	//切换为可运行状态
	e->env_status=ENV_RUNNING;
f01035cc:	c7 43 54 03 00 00 00 	movl   $0x3,0x54(%ebx)
	//运行次数增加。
	curenv->env_runs++;
f01035d3:	e8 32 29 00 00       	call   f0105f0a <cpunum>
f01035d8:	6b c0 74             	imul   $0x74,%eax,%eax
f01035db:	8b 80 28 80 21 f0    	mov    -0xfde7fd8(%eax),%eax
f01035e1:	83 40 58 01          	addl   $0x1,0x58(%eax)
	//切换目录
	lcr3(PADDR(e->env_pgdir));
f01035e5:	8b 43 60             	mov    0x60(%ebx),%eax
	if ((uint32_t)kva < KERNBASE)
f01035e8:	3d ff ff ff ef       	cmp    $0xefffffff,%eax
f01035ed:	76 36                	jbe    f0103625 <env_run+0x9a>
	return (physaddr_t)kva - KERNBASE;
f01035ef:	05 00 00 00 10       	add    $0x10000000,%eax
	asm volatile("movl %0,%%cr3" : : "r" (val));
f01035f4:	0f 22 d8             	mov    %eax,%cr3
}

static inline void
unlock_kernel(void)
{
	spin_unlock(&kernel_lock);
f01035f7:	83 ec 0c             	sub    $0xc,%esp
f01035fa:	68 c0 33 12 f0       	push   $0xf01233c0
f01035ff:	e8 2c 2c 00 00       	call   f0106230 <spin_unlock>

	// Normally we wouldn't need to do this, but QEMU only runs
	// one CPU at a time and has a long time-slice.  Without the
	// pause, this CPU is likely to reacquire the lock before
	// another CPU has even been given a chance to acquire it.
	asm volatile("pause");
f0103604:	f3 90                	pause  
	//将e->env_tf结构中的寄存器快照弹出到寄存器
	unlock_kernel();
	env_pop_tf(&e->env_tf);
f0103606:	89 1c 24             	mov    %ebx,(%esp)
f0103609:	e8 3b ff ff ff       	call   f0103549 <env_pop_tf>
		curenv->env_status=ENV_RUNNABLE;
f010360e:	e8 f7 28 00 00       	call   f0105f0a <cpunum>
f0103613:	6b c0 74             	imul   $0x74,%eax,%eax
f0103616:	8b 80 28 80 21 f0    	mov    -0xfde7fd8(%eax),%eax
f010361c:	c7 40 54 02 00 00 00 	movl   $0x2,0x54(%eax)
f0103623:	eb 99                	jmp    f01035be <env_run+0x33>
		_panic(file, line, "PADDR called with invalid kva %08lx", kva);
f0103625:	50                   	push   %eax
f0103626:	68 c8 65 10 f0       	push   $0xf01065c8
f010362b:	68 3b 02 00 00       	push   $0x23b
f0103630:	68 4c 77 10 f0       	push   $0xf010774c
f0103635:	e8 06 ca ff ff       	call   f0100040 <_panic>

f010363a <mc146818_read>:
#include <kern/kclock.h>


unsigned
mc146818_read(unsigned reg)
{
f010363a:	f3 0f 1e fb          	endbr32 
f010363e:	55                   	push   %ebp
f010363f:	89 e5                	mov    %esp,%ebp
	asm volatile("outb %0,%w1" : : "a" (data), "d" (port));
f0103641:	8b 45 08             	mov    0x8(%ebp),%eax
f0103644:	ba 70 00 00 00       	mov    $0x70,%edx
f0103649:	ee                   	out    %al,(%dx)
	asm volatile("inb %w1,%0" : "=a" (data) : "d" (port));
f010364a:	ba 71 00 00 00       	mov    $0x71,%edx
f010364f:	ec                   	in     (%dx),%al
	outb(IO_RTC, reg);
	return inb(IO_RTC+1);
f0103650:	0f b6 c0             	movzbl %al,%eax
}
f0103653:	5d                   	pop    %ebp
f0103654:	c3                   	ret    

f0103655 <mc146818_write>:

void
mc146818_write(unsigned reg, unsigned datum)
{
f0103655:	f3 0f 1e fb          	endbr32 
f0103659:	55                   	push   %ebp
f010365a:	89 e5                	mov    %esp,%ebp
	asm volatile("outb %0,%w1" : : "a" (data), "d" (port));
f010365c:	8b 45 08             	mov    0x8(%ebp),%eax
f010365f:	ba 70 00 00 00       	mov    $0x70,%edx
f0103664:	ee                   	out    %al,(%dx)
f0103665:	8b 45 0c             	mov    0xc(%ebp),%eax
f0103668:	ba 71 00 00 00       	mov    $0x71,%edx
f010366d:	ee                   	out    %al,(%dx)
	outb(IO_RTC, reg);
	outb(IO_RTC+1, datum);
}
f010366e:	5d                   	pop    %ebp
f010366f:	c3                   	ret    

f0103670 <irq_setmask_8259A>:
		irq_setmask_8259A(irq_mask_8259A);
}

void
irq_setmask_8259A(uint16_t mask)
{
f0103670:	f3 0f 1e fb          	endbr32 
f0103674:	55                   	push   %ebp
f0103675:	89 e5                	mov    %esp,%ebp
f0103677:	56                   	push   %esi
f0103678:	53                   	push   %ebx
f0103679:	8b 45 08             	mov    0x8(%ebp),%eax
	int i;
	irq_mask_8259A = mask;
f010367c:	66 a3 a8 33 12 f0    	mov    %ax,0xf01233a8
	if (!didinit)
f0103682:	80 3d 50 72 21 f0 00 	cmpb   $0x0,0xf0217250
f0103689:	75 07                	jne    f0103692 <irq_setmask_8259A+0x22>
	cprintf("enabled interrupts:");
	for (i = 0; i < 16; i++)
		if (~mask & (1<<i))
			cprintf(" %d", i);
	cprintf("\n");
}
f010368b:	8d 65 f8             	lea    -0x8(%ebp),%esp
f010368e:	5b                   	pop    %ebx
f010368f:	5e                   	pop    %esi
f0103690:	5d                   	pop    %ebp
f0103691:	c3                   	ret    
f0103692:	89 c6                	mov    %eax,%esi
f0103694:	ba 21 00 00 00       	mov    $0x21,%edx
f0103699:	ee                   	out    %al,(%dx)
	outb(IO_PIC2+1, (char)(mask >> 8));
f010369a:	66 c1 e8 08          	shr    $0x8,%ax
f010369e:	ba a1 00 00 00       	mov    $0xa1,%edx
f01036a3:	ee                   	out    %al,(%dx)
	cprintf("enabled interrupts:");
f01036a4:	83 ec 0c             	sub    $0xc,%esp
f01036a7:	68 90 77 10 f0       	push   $0xf0107790
f01036ac:	e8 2c 01 00 00       	call   f01037dd <cprintf>
f01036b1:	83 c4 10             	add    $0x10,%esp
	for (i = 0; i < 16; i++)
f01036b4:	bb 00 00 00 00       	mov    $0x0,%ebx
		if (~mask & (1<<i))
f01036b9:	0f b7 f6             	movzwl %si,%esi
f01036bc:	f7 d6                	not    %esi
f01036be:	eb 19                	jmp    f01036d9 <irq_setmask_8259A+0x69>
			cprintf(" %d", i);
f01036c0:	83 ec 08             	sub    $0x8,%esp
f01036c3:	53                   	push   %ebx
f01036c4:	68 97 7c 10 f0       	push   $0xf0107c97
f01036c9:	e8 0f 01 00 00       	call   f01037dd <cprintf>
f01036ce:	83 c4 10             	add    $0x10,%esp
	for (i = 0; i < 16; i++)
f01036d1:	83 c3 01             	add    $0x1,%ebx
f01036d4:	83 fb 10             	cmp    $0x10,%ebx
f01036d7:	74 07                	je     f01036e0 <irq_setmask_8259A+0x70>
		if (~mask & (1<<i))
f01036d9:	0f a3 de             	bt     %ebx,%esi
f01036dc:	73 f3                	jae    f01036d1 <irq_setmask_8259A+0x61>
f01036de:	eb e0                	jmp    f01036c0 <irq_setmask_8259A+0x50>
	cprintf("\n");
f01036e0:	83 ec 0c             	sub    $0xc,%esp
f01036e3:	68 05 77 10 f0       	push   $0xf0107705
f01036e8:	e8 f0 00 00 00       	call   f01037dd <cprintf>
f01036ed:	83 c4 10             	add    $0x10,%esp
f01036f0:	eb 99                	jmp    f010368b <irq_setmask_8259A+0x1b>

f01036f2 <pic_init>:
{
f01036f2:	f3 0f 1e fb          	endbr32 
f01036f6:	55                   	push   %ebp
f01036f7:	89 e5                	mov    %esp,%ebp
f01036f9:	57                   	push   %edi
f01036fa:	56                   	push   %esi
f01036fb:	53                   	push   %ebx
f01036fc:	83 ec 0c             	sub    $0xc,%esp
	didinit = 1;
f01036ff:	c6 05 50 72 21 f0 01 	movb   $0x1,0xf0217250
f0103706:	b8 ff ff ff ff       	mov    $0xffffffff,%eax
f010370b:	bb 21 00 00 00       	mov    $0x21,%ebx
f0103710:	89 da                	mov    %ebx,%edx
f0103712:	ee                   	out    %al,(%dx)
f0103713:	b9 a1 00 00 00       	mov    $0xa1,%ecx
f0103718:	89 ca                	mov    %ecx,%edx
f010371a:	ee                   	out    %al,(%dx)
f010371b:	bf 11 00 00 00       	mov    $0x11,%edi
f0103720:	be 20 00 00 00       	mov    $0x20,%esi
f0103725:	89 f8                	mov    %edi,%eax
f0103727:	89 f2                	mov    %esi,%edx
f0103729:	ee                   	out    %al,(%dx)
f010372a:	b8 20 00 00 00       	mov    $0x20,%eax
f010372f:	89 da                	mov    %ebx,%edx
f0103731:	ee                   	out    %al,(%dx)
f0103732:	b8 04 00 00 00       	mov    $0x4,%eax
f0103737:	ee                   	out    %al,(%dx)
f0103738:	b8 03 00 00 00       	mov    $0x3,%eax
f010373d:	ee                   	out    %al,(%dx)
f010373e:	bb a0 00 00 00       	mov    $0xa0,%ebx
f0103743:	89 f8                	mov    %edi,%eax
f0103745:	89 da                	mov    %ebx,%edx
f0103747:	ee                   	out    %al,(%dx)
f0103748:	b8 28 00 00 00       	mov    $0x28,%eax
f010374d:	89 ca                	mov    %ecx,%edx
f010374f:	ee                   	out    %al,(%dx)
f0103750:	b8 02 00 00 00       	mov    $0x2,%eax
f0103755:	ee                   	out    %al,(%dx)
f0103756:	b8 01 00 00 00       	mov    $0x1,%eax
f010375b:	ee                   	out    %al,(%dx)
f010375c:	bf 68 00 00 00       	mov    $0x68,%edi
f0103761:	89 f8                	mov    %edi,%eax
f0103763:	89 f2                	mov    %esi,%edx
f0103765:	ee                   	out    %al,(%dx)
f0103766:	b9 0a 00 00 00       	mov    $0xa,%ecx
f010376b:	89 c8                	mov    %ecx,%eax
f010376d:	ee                   	out    %al,(%dx)
f010376e:	89 f8                	mov    %edi,%eax
f0103770:	89 da                	mov    %ebx,%edx
f0103772:	ee                   	out    %al,(%dx)
f0103773:	89 c8                	mov    %ecx,%eax
f0103775:	ee                   	out    %al,(%dx)
	if (irq_mask_8259A != 0xFFFF)
f0103776:	0f b7 05 a8 33 12 f0 	movzwl 0xf01233a8,%eax
f010377d:	66 83 f8 ff          	cmp    $0xffff,%ax
f0103781:	75 08                	jne    f010378b <pic_init+0x99>
}
f0103783:	8d 65 f4             	lea    -0xc(%ebp),%esp
f0103786:	5b                   	pop    %ebx
f0103787:	5e                   	pop    %esi
f0103788:	5f                   	pop    %edi
f0103789:	5d                   	pop    %ebp
f010378a:	c3                   	ret    
		irq_setmask_8259A(irq_mask_8259A);
f010378b:	83 ec 0c             	sub    $0xc,%esp
f010378e:	0f b7 c0             	movzwl %ax,%eax
f0103791:	50                   	push   %eax
f0103792:	e8 d9 fe ff ff       	call   f0103670 <irq_setmask_8259A>
f0103797:	83 c4 10             	add    $0x10,%esp
}
f010379a:	eb e7                	jmp    f0103783 <pic_init+0x91>

f010379c <putch>:
#include <inc/stdarg.h>


static void
putch(int ch, int *cnt)
{
f010379c:	f3 0f 1e fb          	endbr32 
f01037a0:	55                   	push   %ebp
f01037a1:	89 e5                	mov    %esp,%ebp
f01037a3:	83 ec 14             	sub    $0x14,%esp
	cputchar(ch);
f01037a6:	ff 75 08             	pushl  0x8(%ebp)
f01037a9:	e8 fb cf ff ff       	call   f01007a9 <cputchar>
	*cnt++;
}
f01037ae:	83 c4 10             	add    $0x10,%esp
f01037b1:	c9                   	leave  
f01037b2:	c3                   	ret    

f01037b3 <vcprintf>:

int
vcprintf(const char *fmt, va_list ap)
{
f01037b3:	f3 0f 1e fb          	endbr32 
f01037b7:	55                   	push   %ebp
f01037b8:	89 e5                	mov    %esp,%ebp
f01037ba:	83 ec 18             	sub    $0x18,%esp
	int cnt = 0;
f01037bd:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

	vprintfmt((void*)putch, &cnt, fmt, ap);
f01037c4:	ff 75 0c             	pushl  0xc(%ebp)
f01037c7:	ff 75 08             	pushl  0x8(%ebp)
f01037ca:	8d 45 f4             	lea    -0xc(%ebp),%eax
f01037cd:	50                   	push   %eax
f01037ce:	68 9c 37 10 f0       	push   $0xf010379c
f01037d3:	e8 e0 19 00 00       	call   f01051b8 <vprintfmt>
	return cnt;
}
f01037d8:	8b 45 f4             	mov    -0xc(%ebp),%eax
f01037db:	c9                   	leave  
f01037dc:	c3                   	ret    

f01037dd <cprintf>:

int
cprintf(const char *fmt, ...)
{
f01037dd:	f3 0f 1e fb          	endbr32 
f01037e1:	55                   	push   %ebp
f01037e2:	89 e5                	mov    %esp,%ebp
f01037e4:	83 ec 10             	sub    $0x10,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
f01037e7:	8d 45 0c             	lea    0xc(%ebp),%eax
	cnt = vcprintf(fmt, ap);
f01037ea:	50                   	push   %eax
f01037eb:	ff 75 08             	pushl  0x8(%ebp)
f01037ee:	e8 c0 ff ff ff       	call   f01037b3 <vcprintf>
	va_end(ap);

	return cnt;
}
f01037f3:	c9                   	leave  
f01037f4:	c3                   	ret    

f01037f5 <trap_init_percpu>:
}

// Initialize and load the per-CPU TSS and IDT
void
trap_init_percpu(void)
{
f01037f5:	f3 0f 1e fb          	endbr32 
f01037f9:	55                   	push   %ebp
f01037fa:	89 e5                	mov    %esp,%ebp
f01037fc:	57                   	push   %edi
f01037fd:	56                   	push   %esi
f01037fe:	53                   	push   %ebx
f01037ff:	83 ec 0c             	sub    $0xc,%esp
	//
	// LAB 4: Your code here:

	// Setup a TSS so that we get the right stack
	// when we trap to the kernel.
	thiscpu->cpu_ts.ts_esp0 = KSTACKTOP-thiscpu->cpu_id *(KSTKSIZE+KSTKGAP);
f0103802:	e8 03 27 00 00       	call   f0105f0a <cpunum>
f0103807:	6b c0 74             	imul   $0x74,%eax,%eax
f010380a:	0f b6 98 20 80 21 f0 	movzbl -0xfde7fe0(%eax),%ebx
f0103811:	c1 e3 10             	shl    $0x10,%ebx
f0103814:	e8 f1 26 00 00       	call   f0105f0a <cpunum>
f0103819:	6b c0 74             	imul   $0x74,%eax,%eax
f010381c:	ba 00 00 00 f0       	mov    $0xf0000000,%edx
f0103821:	29 da                	sub    %ebx,%edx
f0103823:	89 90 30 80 21 f0    	mov    %edx,-0xfde7fd0(%eax)
	thiscpu->cpu_ts.ts_ss0 = GD_KD;
f0103829:	e8 dc 26 00 00       	call   f0105f0a <cpunum>
f010382e:	6b c0 74             	imul   $0x74,%eax,%eax
f0103831:	66 c7 80 34 80 21 f0 	movw   $0x10,-0xfde7fcc(%eax)
f0103838:	10 00 
	thiscpu->cpu_ts.ts_iomb = sizeof(struct Taskstate);
f010383a:	e8 cb 26 00 00       	call   f0105f0a <cpunum>
f010383f:	6b c0 74             	imul   $0x74,%eax,%eax
f0103842:	66 c7 80 92 80 21 f0 	movw   $0x68,-0xfde7f6e(%eax)
f0103849:	68 00 
	// Initialize the TSS slot of the gdt.
	gdt[(GD_TSS0 >> 3)+thiscpu->cpu_id] = SEG16(STS_T32A, (uint32_t) (&thiscpu->cpu_ts),
f010384b:	e8 ba 26 00 00       	call   f0105f0a <cpunum>
f0103850:	6b c0 74             	imul   $0x74,%eax,%eax
f0103853:	0f b6 b0 20 80 21 f0 	movzbl -0xfde7fe0(%eax),%esi
f010385a:	83 c6 05             	add    $0x5,%esi
f010385d:	e8 a8 26 00 00       	call   f0105f0a <cpunum>
f0103862:	89 c7                	mov    %eax,%edi
f0103864:	e8 a1 26 00 00       	call   f0105f0a <cpunum>
f0103869:	89 c3                	mov    %eax,%ebx
f010386b:	e8 9a 26 00 00       	call   f0105f0a <cpunum>
f0103870:	66 c7 04 f5 40 33 12 	movw   $0x67,-0xfedccc0(,%esi,8)
f0103877:	f0 67 00 
f010387a:	6b ff 74             	imul   $0x74,%edi,%edi
f010387d:	81 c7 2c 80 21 f0    	add    $0xf021802c,%edi
f0103883:	66 89 3c f5 42 33 12 	mov    %di,-0xfedccbe(,%esi,8)
f010388a:	f0 
f010388b:	6b db 74             	imul   $0x74,%ebx,%ebx
f010388e:	81 c3 2c 80 21 f0    	add    $0xf021802c,%ebx
f0103894:	c1 eb 10             	shr    $0x10,%ebx
f0103897:	88 1c f5 44 33 12 f0 	mov    %bl,-0xfedccbc(,%esi,8)
f010389e:	c6 04 f5 45 33 12 f0 	movb   $0x99,-0xfedccbb(,%esi,8)
f01038a5:	99 
f01038a6:	c6 04 f5 46 33 12 f0 	movb   $0x40,-0xfedccba(,%esi,8)
f01038ad:	40 
f01038ae:	6b c0 74             	imul   $0x74,%eax,%eax
f01038b1:	05 2c 80 21 f0       	add    $0xf021802c,%eax
f01038b6:	c1 e8 18             	shr    $0x18,%eax
f01038b9:	88 04 f5 47 33 12 f0 	mov    %al,-0xfedccb9(,%esi,8)
					sizeof(struct Taskstate) - 1, 0);
	gdt[(GD_TSS0 >> 3)+thiscpu->cpu_id].sd_s = 0;
f01038c0:	e8 45 26 00 00       	call   f0105f0a <cpunum>
f01038c5:	6b c0 74             	imul   $0x74,%eax,%eax
f01038c8:	0f b6 80 20 80 21 f0 	movzbl -0xfde7fe0(%eax),%eax
f01038cf:	80 24 c5 6d 33 12 f0 	andb   $0xef,-0xfedcc93(,%eax,8)
f01038d6:	ef 

	// Load the TSS selector (like other segment selectors, the
	// bottom three bits are special; we leave them 0)
	ltr(GD_TSS0+8*thiscpu->cpu_id);
f01038d7:	e8 2e 26 00 00       	call   f0105f0a <cpunum>
f01038dc:	6b c0 74             	imul   $0x74,%eax,%eax
f01038df:	0f b6 80 20 80 21 f0 	movzbl -0xfde7fe0(%eax),%eax
f01038e6:	8d 04 c5 28 00 00 00 	lea    0x28(,%eax,8),%eax
	asm volatile("ltr %0" : : "r" (sel));
f01038ed:	0f 00 d8             	ltr    %ax
	asm volatile("lidt (%0)" : : "r" (p));
f01038f0:	b8 ac 33 12 f0       	mov    $0xf01233ac,%eax
f01038f5:	0f 01 18             	lidtl  (%eax)

	// Load the IDT
	lidt(&idt_pd);
}
f01038f8:	83 c4 0c             	add    $0xc,%esp
f01038fb:	5b                   	pop    %ebx
f01038fc:	5e                   	pop    %esi
f01038fd:	5f                   	pop    %edi
f01038fe:	5d                   	pop    %ebp
f01038ff:	c3                   	ret    

f0103900 <trap_init>:
{
f0103900:	f3 0f 1e fb          	endbr32 
f0103904:	55                   	push   %ebp
f0103905:	89 e5                	mov    %esp,%ebp
f0103907:	83 ec 08             	sub    $0x8,%esp
    SETGATE(idt[T_DIVIDE],0,GD_KT,divide_handler,0);
f010390a:	b8 04 45 10 f0       	mov    $0xf0104504,%eax
f010390f:	66 a3 60 72 21 f0    	mov    %ax,0xf0217260
f0103915:	66 c7 05 62 72 21 f0 	movw   $0x8,0xf0217262
f010391c:	08 00 
f010391e:	c6 05 64 72 21 f0 00 	movb   $0x0,0xf0217264
f0103925:	c6 05 65 72 21 f0 8e 	movb   $0x8e,0xf0217265
f010392c:	c1 e8 10             	shr    $0x10,%eax
f010392f:	66 a3 66 72 21 f0    	mov    %ax,0xf0217266
    SETGATE(idt[T_DEBUG],0,GD_KT,debug_handler,0);
f0103935:	b8 0e 45 10 f0       	mov    $0xf010450e,%eax
f010393a:	66 a3 68 72 21 f0    	mov    %ax,0xf0217268
f0103940:	66 c7 05 6a 72 21 f0 	movw   $0x8,0xf021726a
f0103947:	08 00 
f0103949:	c6 05 6c 72 21 f0 00 	movb   $0x0,0xf021726c
f0103950:	c6 05 6d 72 21 f0 8e 	movb   $0x8e,0xf021726d
f0103957:	c1 e8 10             	shr    $0x10,%eax
f010395a:	66 a3 6e 72 21 f0    	mov    %ax,0xf021726e
    SETGATE(idt[T_NMI],0, GD_KT,nmi_handler,0);
f0103960:	b8 18 45 10 f0       	mov    $0xf0104518,%eax
f0103965:	66 a3 70 72 21 f0    	mov    %ax,0xf0217270
f010396b:	66 c7 05 72 72 21 f0 	movw   $0x8,0xf0217272
f0103972:	08 00 
f0103974:	c6 05 74 72 21 f0 00 	movb   $0x0,0xf0217274
f010397b:	c6 05 75 72 21 f0 8e 	movb   $0x8e,0xf0217275
f0103982:	c1 e8 10             	shr    $0x10,%eax
f0103985:	66 a3 76 72 21 f0    	mov    %ax,0xf0217276
    SETGATE(idt[T_BRKPT],0,GD_KT,brkpt_handler,3);
f010398b:	b8 22 45 10 f0       	mov    $0xf0104522,%eax
f0103990:	66 a3 78 72 21 f0    	mov    %ax,0xf0217278
f0103996:	66 c7 05 7a 72 21 f0 	movw   $0x8,0xf021727a
f010399d:	08 00 
f010399f:	c6 05 7c 72 21 f0 00 	movb   $0x0,0xf021727c
f01039a6:	c6 05 7d 72 21 f0 ee 	movb   $0xee,0xf021727d
f01039ad:	c1 e8 10             	shr    $0x10,%eax
f01039b0:	66 a3 7e 72 21 f0    	mov    %ax,0xf021727e
    SETGATE(idt[T_OFLOW],0,GD_KT,overflow_handler,0);
f01039b6:	b8 2c 45 10 f0       	mov    $0xf010452c,%eax
f01039bb:	66 a3 80 72 21 f0    	mov    %ax,0xf0217280
f01039c1:	66 c7 05 82 72 21 f0 	movw   $0x8,0xf0217282
f01039c8:	08 00 
f01039ca:	c6 05 84 72 21 f0 00 	movb   $0x0,0xf0217284
f01039d1:	c6 05 85 72 21 f0 8e 	movb   $0x8e,0xf0217285
f01039d8:	c1 e8 10             	shr    $0x10,%eax
f01039db:	66 a3 86 72 21 f0    	mov    %ax,0xf0217286
    SETGATE(idt[T_BOUND],0,GD_KT,bounds_handler,0);
f01039e1:	b8 36 45 10 f0       	mov    $0xf0104536,%eax
f01039e6:	66 a3 88 72 21 f0    	mov    %ax,0xf0217288
f01039ec:	66 c7 05 8a 72 21 f0 	movw   $0x8,0xf021728a
f01039f3:	08 00 
f01039f5:	c6 05 8c 72 21 f0 00 	movb   $0x0,0xf021728c
f01039fc:	c6 05 8d 72 21 f0 8e 	movb   $0x8e,0xf021728d
f0103a03:	c1 e8 10             	shr    $0x10,%eax
f0103a06:	66 a3 8e 72 21 f0    	mov    %ax,0xf021728e
    SETGATE(idt[T_ILLOP],0,GD_KT,illegalop_handler,0);
f0103a0c:	b8 40 45 10 f0       	mov    $0xf0104540,%eax
f0103a11:	66 a3 90 72 21 f0    	mov    %ax,0xf0217290
f0103a17:	66 c7 05 92 72 21 f0 	movw   $0x8,0xf0217292
f0103a1e:	08 00 
f0103a20:	c6 05 94 72 21 f0 00 	movb   $0x0,0xf0217294
f0103a27:	c6 05 95 72 21 f0 8e 	movb   $0x8e,0xf0217295
f0103a2e:	c1 e8 10             	shr    $0x10,%eax
f0103a31:	66 a3 96 72 21 f0    	mov    %ax,0xf0217296
    SETGATE(idt[T_DEVICE],0,GD_KT,device_handler,0);
f0103a37:	b8 4a 45 10 f0       	mov    $0xf010454a,%eax
f0103a3c:	66 a3 98 72 21 f0    	mov    %ax,0xf0217298
f0103a42:	66 c7 05 9a 72 21 f0 	movw   $0x8,0xf021729a
f0103a49:	08 00 
f0103a4b:	c6 05 9c 72 21 f0 00 	movb   $0x0,0xf021729c
f0103a52:	c6 05 9d 72 21 f0 8e 	movb   $0x8e,0xf021729d
f0103a59:	c1 e8 10             	shr    $0x10,%eax
f0103a5c:	66 a3 9e 72 21 f0    	mov    %ax,0xf021729e
    SETGATE(idt[T_DBLFLT],0,GD_KT,double_handler,0);
f0103a62:	b8 54 45 10 f0       	mov    $0xf0104554,%eax
f0103a67:	66 a3 a0 72 21 f0    	mov    %ax,0xf02172a0
f0103a6d:	66 c7 05 a2 72 21 f0 	movw   $0x8,0xf02172a2
f0103a74:	08 00 
f0103a76:	c6 05 a4 72 21 f0 00 	movb   $0x0,0xf02172a4
f0103a7d:	c6 05 a5 72 21 f0 8e 	movb   $0x8e,0xf02172a5
f0103a84:	c1 e8 10             	shr    $0x10,%eax
f0103a87:	66 a3 a6 72 21 f0    	mov    %ax,0xf02172a6
    SETGATE(idt[T_TSS],0,GD_KT,taskswitch_handler,0);
f0103a8d:	b8 5c 45 10 f0       	mov    $0xf010455c,%eax
f0103a92:	66 a3 b0 72 21 f0    	mov    %ax,0xf02172b0
f0103a98:	66 c7 05 b2 72 21 f0 	movw   $0x8,0xf02172b2
f0103a9f:	08 00 
f0103aa1:	c6 05 b4 72 21 f0 00 	movb   $0x0,0xf02172b4
f0103aa8:	c6 05 b5 72 21 f0 8e 	movb   $0x8e,0xf02172b5
f0103aaf:	c1 e8 10             	shr    $0x10,%eax
f0103ab2:	66 a3 b6 72 21 f0    	mov    %ax,0xf02172b6
    SETGATE(idt[T_SEGNP],0,GD_KT,segment_handler,0);
f0103ab8:	b8 64 45 10 f0       	mov    $0xf0104564,%eax
f0103abd:	66 a3 b8 72 21 f0    	mov    %ax,0xf02172b8
f0103ac3:	66 c7 05 ba 72 21 f0 	movw   $0x8,0xf02172ba
f0103aca:	08 00 
f0103acc:	c6 05 bc 72 21 f0 00 	movb   $0x0,0xf02172bc
f0103ad3:	c6 05 bd 72 21 f0 8e 	movb   $0x8e,0xf02172bd
f0103ada:	c1 e8 10             	shr    $0x10,%eax
f0103add:	66 a3 be 72 21 f0    	mov    %ax,0xf02172be
    SETGATE(idt[T_STACK],0,GD_KT,stack_handler,0);
f0103ae3:	b8 6c 45 10 f0       	mov    $0xf010456c,%eax
f0103ae8:	66 a3 c0 72 21 f0    	mov    %ax,0xf02172c0
f0103aee:	66 c7 05 c2 72 21 f0 	movw   $0x8,0xf02172c2
f0103af5:	08 00 
f0103af7:	c6 05 c4 72 21 f0 00 	movb   $0x0,0xf02172c4
f0103afe:	c6 05 c5 72 21 f0 8e 	movb   $0x8e,0xf02172c5
f0103b05:	c1 e8 10             	shr    $0x10,%eax
f0103b08:	66 a3 c6 72 21 f0    	mov    %ax,0xf02172c6
    SETGATE(idt[T_GPFLT],0,GD_KT,protection_handler,0);
f0103b0e:	b8 74 45 10 f0       	mov    $0xf0104574,%eax
f0103b13:	66 a3 c8 72 21 f0    	mov    %ax,0xf02172c8
f0103b19:	66 c7 05 ca 72 21 f0 	movw   $0x8,0xf02172ca
f0103b20:	08 00 
f0103b22:	c6 05 cc 72 21 f0 00 	movb   $0x0,0xf02172cc
f0103b29:	c6 05 cd 72 21 f0 8e 	movb   $0x8e,0xf02172cd
f0103b30:	c1 e8 10             	shr    $0x10,%eax
f0103b33:	66 a3 ce 72 21 f0    	mov    %ax,0xf02172ce
    SETGATE(idt[T_PGFLT],0,GD_KT,page_handler,0);
f0103b39:	b8 7c 45 10 f0       	mov    $0xf010457c,%eax
f0103b3e:	66 a3 d0 72 21 f0    	mov    %ax,0xf02172d0
f0103b44:	66 c7 05 d2 72 21 f0 	movw   $0x8,0xf02172d2
f0103b4b:	08 00 
f0103b4d:	c6 05 d4 72 21 f0 00 	movb   $0x0,0xf02172d4
f0103b54:	c6 05 d5 72 21 f0 8e 	movb   $0x8e,0xf02172d5
f0103b5b:	c1 e8 10             	shr    $0x10,%eax
f0103b5e:	66 a3 d6 72 21 f0    	mov    %ax,0xf02172d6
    SETGATE(idt[T_FPERR],0,GD_KT,floating_handler,0);
f0103b64:	b8 84 45 10 f0       	mov    $0xf0104584,%eax
f0103b69:	66 a3 e0 72 21 f0    	mov    %ax,0xf02172e0
f0103b6f:	66 c7 05 e2 72 21 f0 	movw   $0x8,0xf02172e2
f0103b76:	08 00 
f0103b78:	c6 05 e4 72 21 f0 00 	movb   $0x0,0xf02172e4
f0103b7f:	c6 05 e5 72 21 f0 8e 	movb   $0x8e,0xf02172e5
f0103b86:	c1 e8 10             	shr    $0x10,%eax
f0103b89:	66 a3 e6 72 21 f0    	mov    %ax,0xf02172e6
    SETGATE(idt[T_ALIGN],0,GD_KT,aligment_handler,0);
f0103b8f:	b8 8e 45 10 f0       	mov    $0xf010458e,%eax
f0103b94:	66 a3 e8 72 21 f0    	mov    %ax,0xf02172e8
f0103b9a:	66 c7 05 ea 72 21 f0 	movw   $0x8,0xf02172ea
f0103ba1:	08 00 
f0103ba3:	c6 05 ec 72 21 f0 00 	movb   $0x0,0xf02172ec
f0103baa:	c6 05 ed 72 21 f0 8e 	movb   $0x8e,0xf02172ed
f0103bb1:	c1 e8 10             	shr    $0x10,%eax
f0103bb4:	66 a3 ee 72 21 f0    	mov    %ax,0xf02172ee
    SETGATE(idt[T_MCHK],0,GD_KT,machine_handler,0);
f0103bba:	b8 94 45 10 f0       	mov    $0xf0104594,%eax
f0103bbf:	66 a3 f0 72 21 f0    	mov    %ax,0xf02172f0
f0103bc5:	66 c7 05 f2 72 21 f0 	movw   $0x8,0xf02172f2
f0103bcc:	08 00 
f0103bce:	c6 05 f4 72 21 f0 00 	movb   $0x0,0xf02172f4
f0103bd5:	c6 05 f5 72 21 f0 8e 	movb   $0x8e,0xf02172f5
f0103bdc:	c1 e8 10             	shr    $0x10,%eax
f0103bdf:	66 a3 f6 72 21 f0    	mov    %ax,0xf02172f6
    SETGATE(idt[T_SIMDERR],0,GD_KT,simd_handler,0);
f0103be5:	b8 9a 45 10 f0       	mov    $0xf010459a,%eax
f0103bea:	66 a3 f8 72 21 f0    	mov    %ax,0xf02172f8
f0103bf0:	66 c7 05 fa 72 21 f0 	movw   $0x8,0xf02172fa
f0103bf7:	08 00 
f0103bf9:	c6 05 fc 72 21 f0 00 	movb   $0x0,0xf02172fc
f0103c00:	c6 05 fd 72 21 f0 8e 	movb   $0x8e,0xf02172fd
f0103c07:	c1 e8 10             	shr    $0x10,%eax
f0103c0a:	66 a3 fe 72 21 f0    	mov    %ax,0xf02172fe
    SETGATE(idt[T_SYSCALL],0,GD_KT,syscall_handler,3);
f0103c10:	b8 a0 45 10 f0       	mov    $0xf01045a0,%eax
f0103c15:	66 a3 e0 73 21 f0    	mov    %ax,0xf02173e0
f0103c1b:	66 c7 05 e2 73 21 f0 	movw   $0x8,0xf02173e2
f0103c22:	08 00 
f0103c24:	c6 05 e4 73 21 f0 00 	movb   $0x0,0xf02173e4
f0103c2b:	c6 05 e5 73 21 f0 ee 	movb   $0xee,0xf02173e5
f0103c32:	c1 e8 10             	shr    $0x10,%eax
f0103c35:	66 a3 e6 73 21 f0    	mov    %ax,0xf02173e6
    SETGATE(idt[T_DEFAULT],0,GD_KT,default_handler,0);
f0103c3b:	b8 a6 45 10 f0       	mov    $0xf01045a6,%eax
f0103c40:	66 a3 00 82 21 f0    	mov    %ax,0xf0218200
f0103c46:	66 c7 05 02 82 21 f0 	movw   $0x8,0xf0218202
f0103c4d:	08 00 
f0103c4f:	c6 05 04 82 21 f0 00 	movb   $0x0,0xf0218204
f0103c56:	c6 05 05 82 21 f0 8e 	movb   $0x8e,0xf0218205
f0103c5d:	c1 e8 10             	shr    $0x10,%eax
f0103c60:	66 a3 06 82 21 f0    	mov    %ax,0xf0218206
	SETGATE(idt[IRQ_OFFSET + IRQ_TIMER], 0, GD_KT, IRQ0_Timer_handler, 0);
f0103c66:	b8 b0 45 10 f0       	mov    $0xf01045b0,%eax
f0103c6b:	66 a3 60 73 21 f0    	mov    %ax,0xf0217360
f0103c71:	66 c7 05 62 73 21 f0 	movw   $0x8,0xf0217362
f0103c78:	08 00 
f0103c7a:	c6 05 64 73 21 f0 00 	movb   $0x0,0xf0217364
f0103c81:	c6 05 65 73 21 f0 8e 	movb   $0x8e,0xf0217365
f0103c88:	c1 e8 10             	shr    $0x10,%eax
f0103c8b:	66 a3 66 73 21 f0    	mov    %ax,0xf0217366
	SETGATE(idt[IRQ_OFFSET + IRQ_KBD], 0, GD_KT, IRQ1_Kbd_handler, 0);
f0103c91:	b8 b6 45 10 f0       	mov    $0xf01045b6,%eax
f0103c96:	66 a3 68 73 21 f0    	mov    %ax,0xf0217368
f0103c9c:	66 c7 05 6a 73 21 f0 	movw   $0x8,0xf021736a
f0103ca3:	08 00 
f0103ca5:	c6 05 6c 73 21 f0 00 	movb   $0x0,0xf021736c
f0103cac:	c6 05 6d 73 21 f0 8e 	movb   $0x8e,0xf021736d
f0103cb3:	c1 e8 10             	shr    $0x10,%eax
f0103cb6:	66 a3 6e 73 21 f0    	mov    %ax,0xf021736e
	SETGATE(idt[IRQ_OFFSET + 2], 0, GD_KT, IRQ_2, 0);
f0103cbc:	b8 bc 45 10 f0       	mov    $0xf01045bc,%eax
f0103cc1:	66 a3 70 73 21 f0    	mov    %ax,0xf0217370
f0103cc7:	66 c7 05 72 73 21 f0 	movw   $0x8,0xf0217372
f0103cce:	08 00 
f0103cd0:	c6 05 74 73 21 f0 00 	movb   $0x0,0xf0217374
f0103cd7:	c6 05 75 73 21 f0 8e 	movb   $0x8e,0xf0217375
f0103cde:	c1 e8 10             	shr    $0x10,%eax
f0103ce1:	66 a3 76 73 21 f0    	mov    %ax,0xf0217376
	SETGATE(idt[IRQ_OFFSET + 3], 0, GD_KT, IRQ_3, 0);
f0103ce7:	b8 c2 45 10 f0       	mov    $0xf01045c2,%eax
f0103cec:	66 a3 78 73 21 f0    	mov    %ax,0xf0217378
f0103cf2:	66 c7 05 7a 73 21 f0 	movw   $0x8,0xf021737a
f0103cf9:	08 00 
f0103cfb:	c6 05 7c 73 21 f0 00 	movb   $0x0,0xf021737c
f0103d02:	c6 05 7d 73 21 f0 8e 	movb   $0x8e,0xf021737d
f0103d09:	c1 e8 10             	shr    $0x10,%eax
f0103d0c:	66 a3 7e 73 21 f0    	mov    %ax,0xf021737e
	SETGATE(idt[IRQ_OFFSET + IRQ_SERIAL], 0, GD_KT, IRQ4_Serial_handler, 0);
f0103d12:	b8 c8 45 10 f0       	mov    $0xf01045c8,%eax
f0103d17:	66 a3 80 73 21 f0    	mov    %ax,0xf0217380
f0103d1d:	66 c7 05 82 73 21 f0 	movw   $0x8,0xf0217382
f0103d24:	08 00 
f0103d26:	c6 05 84 73 21 f0 00 	movb   $0x0,0xf0217384
f0103d2d:	c6 05 85 73 21 f0 8e 	movb   $0x8e,0xf0217385
f0103d34:	c1 e8 10             	shr    $0x10,%eax
f0103d37:	66 a3 86 73 21 f0    	mov    %ax,0xf0217386
	SETGATE(idt[IRQ_OFFSET + 5], 0, GD_KT, IRQ_5, 0);
f0103d3d:	b8 ce 45 10 f0       	mov    $0xf01045ce,%eax
f0103d42:	66 a3 88 73 21 f0    	mov    %ax,0xf0217388
f0103d48:	66 c7 05 8a 73 21 f0 	movw   $0x8,0xf021738a
f0103d4f:	08 00 
f0103d51:	c6 05 8c 73 21 f0 00 	movb   $0x0,0xf021738c
f0103d58:	c6 05 8d 73 21 f0 8e 	movb   $0x8e,0xf021738d
f0103d5f:	c1 e8 10             	shr    $0x10,%eax
f0103d62:	66 a3 8e 73 21 f0    	mov    %ax,0xf021738e
	SETGATE(idt[IRQ_OFFSET + 6], 0, GD_KT, IRQ_6, 0);
f0103d68:	b8 d4 45 10 f0       	mov    $0xf01045d4,%eax
f0103d6d:	66 a3 90 73 21 f0    	mov    %ax,0xf0217390
f0103d73:	66 c7 05 92 73 21 f0 	movw   $0x8,0xf0217392
f0103d7a:	08 00 
f0103d7c:	c6 05 94 73 21 f0 00 	movb   $0x0,0xf0217394
f0103d83:	c6 05 95 73 21 f0 8e 	movb   $0x8e,0xf0217395
f0103d8a:	c1 e8 10             	shr    $0x10,%eax
f0103d8d:	66 a3 96 73 21 f0    	mov    %ax,0xf0217396
	SETGATE(idt[IRQ_OFFSET + IRQ_SPURIOUS], 0, GD_KT, IRQ7_Spurious_handler, 0);
f0103d93:	b8 da 45 10 f0       	mov    $0xf01045da,%eax
f0103d98:	66 a3 98 73 21 f0    	mov    %ax,0xf0217398
f0103d9e:	66 c7 05 9a 73 21 f0 	movw   $0x8,0xf021739a
f0103da5:	08 00 
f0103da7:	c6 05 9c 73 21 f0 00 	movb   $0x0,0xf021739c
f0103dae:	c6 05 9d 73 21 f0 8e 	movb   $0x8e,0xf021739d
f0103db5:	c1 e8 10             	shr    $0x10,%eax
f0103db8:	66 a3 9e 73 21 f0    	mov    %ax,0xf021739e
	SETGATE(idt[IRQ_OFFSET + 8], 0, GD_KT, IRQ_8, 0);
f0103dbe:	b8 e0 45 10 f0       	mov    $0xf01045e0,%eax
f0103dc3:	66 a3 a0 73 21 f0    	mov    %ax,0xf02173a0
f0103dc9:	66 c7 05 a2 73 21 f0 	movw   $0x8,0xf02173a2
f0103dd0:	08 00 
f0103dd2:	c6 05 a4 73 21 f0 00 	movb   $0x0,0xf02173a4
f0103dd9:	c6 05 a5 73 21 f0 8e 	movb   $0x8e,0xf02173a5
f0103de0:	c1 e8 10             	shr    $0x10,%eax
f0103de3:	66 a3 a6 73 21 f0    	mov    %ax,0xf02173a6
	SETGATE(idt[IRQ_OFFSET + 9], 0, GD_KT, IRQ_9, 0);
f0103de9:	b8 e6 45 10 f0       	mov    $0xf01045e6,%eax
f0103dee:	66 a3 a8 73 21 f0    	mov    %ax,0xf02173a8
f0103df4:	66 c7 05 aa 73 21 f0 	movw   $0x8,0xf02173aa
f0103dfb:	08 00 
f0103dfd:	c6 05 ac 73 21 f0 00 	movb   $0x0,0xf02173ac
f0103e04:	c6 05 ad 73 21 f0 8e 	movb   $0x8e,0xf02173ad
f0103e0b:	c1 e8 10             	shr    $0x10,%eax
f0103e0e:	66 a3 ae 73 21 f0    	mov    %ax,0xf02173ae
	SETGATE(idt[IRQ_OFFSET + 10], 0, GD_KT, IRQ_10, 0);
f0103e14:	b8 ec 45 10 f0       	mov    $0xf01045ec,%eax
f0103e19:	66 a3 b0 73 21 f0    	mov    %ax,0xf02173b0
f0103e1f:	66 c7 05 b2 73 21 f0 	movw   $0x8,0xf02173b2
f0103e26:	08 00 
f0103e28:	c6 05 b4 73 21 f0 00 	movb   $0x0,0xf02173b4
f0103e2f:	c6 05 b5 73 21 f0 8e 	movb   $0x8e,0xf02173b5
f0103e36:	c1 e8 10             	shr    $0x10,%eax
f0103e39:	66 a3 b6 73 21 f0    	mov    %ax,0xf02173b6
	SETGATE(idt[IRQ_OFFSET + 11], 0, GD_KT, IRQ_11, 0);
f0103e3f:	b8 f2 45 10 f0       	mov    $0xf01045f2,%eax
f0103e44:	66 a3 b8 73 21 f0    	mov    %ax,0xf02173b8
f0103e4a:	66 c7 05 ba 73 21 f0 	movw   $0x8,0xf02173ba
f0103e51:	08 00 
f0103e53:	c6 05 bc 73 21 f0 00 	movb   $0x0,0xf02173bc
f0103e5a:	c6 05 bd 73 21 f0 8e 	movb   $0x8e,0xf02173bd
f0103e61:	c1 e8 10             	shr    $0x10,%eax
f0103e64:	66 a3 be 73 21 f0    	mov    %ax,0xf02173be
	SETGATE(idt[IRQ_OFFSET + 12], 0, GD_KT, IRQ_12, 0);
f0103e6a:	b8 f8 45 10 f0       	mov    $0xf01045f8,%eax
f0103e6f:	66 a3 c0 73 21 f0    	mov    %ax,0xf02173c0
f0103e75:	66 c7 05 c2 73 21 f0 	movw   $0x8,0xf02173c2
f0103e7c:	08 00 
f0103e7e:	c6 05 c4 73 21 f0 00 	movb   $0x0,0xf02173c4
f0103e85:	c6 05 c5 73 21 f0 8e 	movb   $0x8e,0xf02173c5
f0103e8c:	c1 e8 10             	shr    $0x10,%eax
f0103e8f:	66 a3 c6 73 21 f0    	mov    %ax,0xf02173c6
	SETGATE(idt[IRQ_OFFSET + 13], 0, GD_KT, IRQ_13, 0);
f0103e95:	b8 fe 45 10 f0       	mov    $0xf01045fe,%eax
f0103e9a:	66 a3 c8 73 21 f0    	mov    %ax,0xf02173c8
f0103ea0:	66 c7 05 ca 73 21 f0 	movw   $0x8,0xf02173ca
f0103ea7:	08 00 
f0103ea9:	c6 05 cc 73 21 f0 00 	movb   $0x0,0xf02173cc
f0103eb0:	c6 05 cd 73 21 f0 8e 	movb   $0x8e,0xf02173cd
f0103eb7:	c1 e8 10             	shr    $0x10,%eax
f0103eba:	66 a3 ce 73 21 f0    	mov    %ax,0xf02173ce
	SETGATE(idt[IRQ_OFFSET + IRQ_IDE], 0, GD_KT, IRQ14_Ide_handler, 0);
f0103ec0:	b8 04 46 10 f0       	mov    $0xf0104604,%eax
f0103ec5:	66 a3 d0 73 21 f0    	mov    %ax,0xf02173d0
f0103ecb:	66 c7 05 d2 73 21 f0 	movw   $0x8,0xf02173d2
f0103ed2:	08 00 
f0103ed4:	c6 05 d4 73 21 f0 00 	movb   $0x0,0xf02173d4
f0103edb:	c6 05 d5 73 21 f0 8e 	movb   $0x8e,0xf02173d5
f0103ee2:	c1 e8 10             	shr    $0x10,%eax
f0103ee5:	66 a3 d6 73 21 f0    	mov    %ax,0xf02173d6
	SETGATE(idt[IRQ_OFFSET + 15], 0, GD_KT, IRQ_15, 0);
f0103eeb:	b8 0a 46 10 f0       	mov    $0xf010460a,%eax
f0103ef0:	66 a3 d8 73 21 f0    	mov    %ax,0xf02173d8
f0103ef6:	66 c7 05 da 73 21 f0 	movw   $0x8,0xf02173da
f0103efd:	08 00 
f0103eff:	c6 05 dc 73 21 f0 00 	movb   $0x0,0xf02173dc
f0103f06:	c6 05 dd 73 21 f0 8e 	movb   $0x8e,0xf02173dd
f0103f0d:	c1 e8 10             	shr    $0x10,%eax
f0103f10:	66 a3 de 73 21 f0    	mov    %ax,0xf02173de
	trap_init_percpu();
f0103f16:	e8 da f8 ff ff       	call   f01037f5 <trap_init_percpu>
}
f0103f1b:	c9                   	leave  
f0103f1c:	c3                   	ret    

f0103f1d <print_regs>:
	}
}

void
print_regs(struct PushRegs *regs)
{
f0103f1d:	f3 0f 1e fb          	endbr32 
f0103f21:	55                   	push   %ebp
f0103f22:	89 e5                	mov    %esp,%ebp
f0103f24:	53                   	push   %ebx
f0103f25:	83 ec 0c             	sub    $0xc,%esp
f0103f28:	8b 5d 08             	mov    0x8(%ebp),%ebx
	cprintf("  edi  0x%08x\n", regs->reg_edi);
f0103f2b:	ff 33                	pushl  (%ebx)
f0103f2d:	68 a4 77 10 f0       	push   $0xf01077a4
f0103f32:	e8 a6 f8 ff ff       	call   f01037dd <cprintf>
	cprintf("  esi  0x%08x\n", regs->reg_esi);
f0103f37:	83 c4 08             	add    $0x8,%esp
f0103f3a:	ff 73 04             	pushl  0x4(%ebx)
f0103f3d:	68 b3 77 10 f0       	push   $0xf01077b3
f0103f42:	e8 96 f8 ff ff       	call   f01037dd <cprintf>
	cprintf("  ebp  0x%08x\n", regs->reg_ebp);
f0103f47:	83 c4 08             	add    $0x8,%esp
f0103f4a:	ff 73 08             	pushl  0x8(%ebx)
f0103f4d:	68 c2 77 10 f0       	push   $0xf01077c2
f0103f52:	e8 86 f8 ff ff       	call   f01037dd <cprintf>
	cprintf("  oesp 0x%08x\n", regs->reg_oesp);
f0103f57:	83 c4 08             	add    $0x8,%esp
f0103f5a:	ff 73 0c             	pushl  0xc(%ebx)
f0103f5d:	68 d1 77 10 f0       	push   $0xf01077d1
f0103f62:	e8 76 f8 ff ff       	call   f01037dd <cprintf>
	cprintf("  ebx  0x%08x\n", regs->reg_ebx);
f0103f67:	83 c4 08             	add    $0x8,%esp
f0103f6a:	ff 73 10             	pushl  0x10(%ebx)
f0103f6d:	68 e0 77 10 f0       	push   $0xf01077e0
f0103f72:	e8 66 f8 ff ff       	call   f01037dd <cprintf>
	cprintf("  edx  0x%08x\n", regs->reg_edx);
f0103f77:	83 c4 08             	add    $0x8,%esp
f0103f7a:	ff 73 14             	pushl  0x14(%ebx)
f0103f7d:	68 ef 77 10 f0       	push   $0xf01077ef
f0103f82:	e8 56 f8 ff ff       	call   f01037dd <cprintf>
	cprintf("  ecx  0x%08x\n", regs->reg_ecx);
f0103f87:	83 c4 08             	add    $0x8,%esp
f0103f8a:	ff 73 18             	pushl  0x18(%ebx)
f0103f8d:	68 fe 77 10 f0       	push   $0xf01077fe
f0103f92:	e8 46 f8 ff ff       	call   f01037dd <cprintf>
	cprintf("  eax  0x%08x\n", regs->reg_eax);
f0103f97:	83 c4 08             	add    $0x8,%esp
f0103f9a:	ff 73 1c             	pushl  0x1c(%ebx)
f0103f9d:	68 0d 78 10 f0       	push   $0xf010780d
f0103fa2:	e8 36 f8 ff ff       	call   f01037dd <cprintf>
}
f0103fa7:	83 c4 10             	add    $0x10,%esp
f0103faa:	8b 5d fc             	mov    -0x4(%ebp),%ebx
f0103fad:	c9                   	leave  
f0103fae:	c3                   	ret    

f0103faf <print_trapframe>:
{
f0103faf:	f3 0f 1e fb          	endbr32 
f0103fb3:	55                   	push   %ebp
f0103fb4:	89 e5                	mov    %esp,%ebp
f0103fb6:	56                   	push   %esi
f0103fb7:	53                   	push   %ebx
f0103fb8:	8b 5d 08             	mov    0x8(%ebp),%ebx
	cprintf("TRAP frame at %p from CPU %d\n", tf, cpunum());
f0103fbb:	e8 4a 1f 00 00       	call   f0105f0a <cpunum>
f0103fc0:	83 ec 04             	sub    $0x4,%esp
f0103fc3:	50                   	push   %eax
f0103fc4:	53                   	push   %ebx
f0103fc5:	68 71 78 10 f0       	push   $0xf0107871
f0103fca:	e8 0e f8 ff ff       	call   f01037dd <cprintf>
	print_regs(&tf->tf_regs);
f0103fcf:	89 1c 24             	mov    %ebx,(%esp)
f0103fd2:	e8 46 ff ff ff       	call   f0103f1d <print_regs>
	cprintf("  es   0x----%04x\n", tf->tf_es);
f0103fd7:	83 c4 08             	add    $0x8,%esp
f0103fda:	0f b7 43 20          	movzwl 0x20(%ebx),%eax
f0103fde:	50                   	push   %eax
f0103fdf:	68 8f 78 10 f0       	push   $0xf010788f
f0103fe4:	e8 f4 f7 ff ff       	call   f01037dd <cprintf>
	cprintf("  ds   0x----%04x\n", tf->tf_ds);
f0103fe9:	83 c4 08             	add    $0x8,%esp
f0103fec:	0f b7 43 24          	movzwl 0x24(%ebx),%eax
f0103ff0:	50                   	push   %eax
f0103ff1:	68 a2 78 10 f0       	push   $0xf01078a2
f0103ff6:	e8 e2 f7 ff ff       	call   f01037dd <cprintf>
	cprintf("  trap 0x%08x %s\n", tf->tf_trapno, trapname(tf->tf_trapno));
f0103ffb:	8b 43 28             	mov    0x28(%ebx),%eax
	if (trapno < ARRAY_SIZE(excnames))
f0103ffe:	83 c4 10             	add    $0x10,%esp
f0104001:	83 f8 13             	cmp    $0x13,%eax
f0104004:	0f 86 da 00 00 00    	jbe    f01040e4 <print_trapframe+0x135>
		return "System call";
f010400a:	ba 1c 78 10 f0       	mov    $0xf010781c,%edx
	if (trapno == T_SYSCALL)
f010400f:	83 f8 30             	cmp    $0x30,%eax
f0104012:	74 13                	je     f0104027 <print_trapframe+0x78>
	if (trapno >= IRQ_OFFSET && trapno < IRQ_OFFSET + 16)
f0104014:	8d 50 e0             	lea    -0x20(%eax),%edx
		return "Hardware Interrupt";
f0104017:	83 fa 0f             	cmp    $0xf,%edx
f010401a:	ba 28 78 10 f0       	mov    $0xf0107828,%edx
f010401f:	b9 37 78 10 f0       	mov    $0xf0107837,%ecx
f0104024:	0f 46 d1             	cmovbe %ecx,%edx
	cprintf("  trap 0x%08x %s\n", tf->tf_trapno, trapname(tf->tf_trapno));
f0104027:	83 ec 04             	sub    $0x4,%esp
f010402a:	52                   	push   %edx
f010402b:	50                   	push   %eax
f010402c:	68 b5 78 10 f0       	push   $0xf01078b5
f0104031:	e8 a7 f7 ff ff       	call   f01037dd <cprintf>
	if (tf == last_tf && tf->tf_trapno == T_PGFLT)
f0104036:	83 c4 10             	add    $0x10,%esp
f0104039:	39 1d 60 7a 21 f0    	cmp    %ebx,0xf0217a60
f010403f:	0f 84 ab 00 00 00    	je     f01040f0 <print_trapframe+0x141>
	cprintf("  err  0x%08x", tf->tf_err);
f0104045:	83 ec 08             	sub    $0x8,%esp
f0104048:	ff 73 2c             	pushl  0x2c(%ebx)
f010404b:	68 d6 78 10 f0       	push   $0xf01078d6
f0104050:	e8 88 f7 ff ff       	call   f01037dd <cprintf>
	if (tf->tf_trapno == T_PGFLT)
f0104055:	83 c4 10             	add    $0x10,%esp
f0104058:	83 7b 28 0e          	cmpl   $0xe,0x28(%ebx)
f010405c:	0f 85 b1 00 00 00    	jne    f0104113 <print_trapframe+0x164>
			tf->tf_err & 1 ? "protection" : "not-present");
f0104062:	8b 43 2c             	mov    0x2c(%ebx),%eax
		cprintf(" [%s, %s, %s]\n",
f0104065:	a8 01                	test   $0x1,%al
f0104067:	b9 4a 78 10 f0       	mov    $0xf010784a,%ecx
f010406c:	ba 55 78 10 f0       	mov    $0xf0107855,%edx
f0104071:	0f 44 ca             	cmove  %edx,%ecx
f0104074:	a8 02                	test   $0x2,%al
f0104076:	be 61 78 10 f0       	mov    $0xf0107861,%esi
f010407b:	ba 67 78 10 f0       	mov    $0xf0107867,%edx
f0104080:	0f 45 d6             	cmovne %esi,%edx
f0104083:	a8 04                	test   $0x4,%al
f0104085:	b8 6c 78 10 f0       	mov    $0xf010786c,%eax
f010408a:	be a1 79 10 f0       	mov    $0xf01079a1,%esi
f010408f:	0f 44 c6             	cmove  %esi,%eax
f0104092:	51                   	push   %ecx
f0104093:	52                   	push   %edx
f0104094:	50                   	push   %eax
f0104095:	68 e4 78 10 f0       	push   $0xf01078e4
f010409a:	e8 3e f7 ff ff       	call   f01037dd <cprintf>
f010409f:	83 c4 10             	add    $0x10,%esp
	cprintf("  eip  0x%08x\n", tf->tf_eip);
f01040a2:	83 ec 08             	sub    $0x8,%esp
f01040a5:	ff 73 30             	pushl  0x30(%ebx)
f01040a8:	68 f3 78 10 f0       	push   $0xf01078f3
f01040ad:	e8 2b f7 ff ff       	call   f01037dd <cprintf>
	cprintf("  cs   0x----%04x\n", tf->tf_cs);
f01040b2:	83 c4 08             	add    $0x8,%esp
f01040b5:	0f b7 43 34          	movzwl 0x34(%ebx),%eax
f01040b9:	50                   	push   %eax
f01040ba:	68 02 79 10 f0       	push   $0xf0107902
f01040bf:	e8 19 f7 ff ff       	call   f01037dd <cprintf>
	cprintf("  flag 0x%08x\n", tf->tf_eflags);
f01040c4:	83 c4 08             	add    $0x8,%esp
f01040c7:	ff 73 38             	pushl  0x38(%ebx)
f01040ca:	68 15 79 10 f0       	push   $0xf0107915
f01040cf:	e8 09 f7 ff ff       	call   f01037dd <cprintf>
	if ((tf->tf_cs & 3) != 0) {
f01040d4:	83 c4 10             	add    $0x10,%esp
f01040d7:	f6 43 34 03          	testb  $0x3,0x34(%ebx)
f01040db:	75 4b                	jne    f0104128 <print_trapframe+0x179>
}
f01040dd:	8d 65 f8             	lea    -0x8(%ebp),%esp
f01040e0:	5b                   	pop    %ebx
f01040e1:	5e                   	pop    %esi
f01040e2:	5d                   	pop    %ebp
f01040e3:	c3                   	ret    
		return excnames[trapno];
f01040e4:	8b 14 85 60 7b 10 f0 	mov    -0xfef84a0(,%eax,4),%edx
f01040eb:	e9 37 ff ff ff       	jmp    f0104027 <print_trapframe+0x78>
	if (tf == last_tf && tf->tf_trapno == T_PGFLT)
f01040f0:	83 7b 28 0e          	cmpl   $0xe,0x28(%ebx)
f01040f4:	0f 85 4b ff ff ff    	jne    f0104045 <print_trapframe+0x96>
	asm volatile("movl %%cr2,%0" : "=r" (val));
f01040fa:	0f 20 d0             	mov    %cr2,%eax
		cprintf("  cr2  0x%08x\n", rcr2());
f01040fd:	83 ec 08             	sub    $0x8,%esp
f0104100:	50                   	push   %eax
f0104101:	68 c7 78 10 f0       	push   $0xf01078c7
f0104106:	e8 d2 f6 ff ff       	call   f01037dd <cprintf>
f010410b:	83 c4 10             	add    $0x10,%esp
f010410e:	e9 32 ff ff ff       	jmp    f0104045 <print_trapframe+0x96>
		cprintf("\n");
f0104113:	83 ec 0c             	sub    $0xc,%esp
f0104116:	68 05 77 10 f0       	push   $0xf0107705
f010411b:	e8 bd f6 ff ff       	call   f01037dd <cprintf>
f0104120:	83 c4 10             	add    $0x10,%esp
f0104123:	e9 7a ff ff ff       	jmp    f01040a2 <print_trapframe+0xf3>
		cprintf("  esp  0x%08x\n", tf->tf_esp);
f0104128:	83 ec 08             	sub    $0x8,%esp
f010412b:	ff 73 3c             	pushl  0x3c(%ebx)
f010412e:	68 24 79 10 f0       	push   $0xf0107924
f0104133:	e8 a5 f6 ff ff       	call   f01037dd <cprintf>
		cprintf("  ss   0x----%04x\n", tf->tf_ss);
f0104138:	83 c4 08             	add    $0x8,%esp
f010413b:	0f b7 43 40          	movzwl 0x40(%ebx),%eax
f010413f:	50                   	push   %eax
f0104140:	68 33 79 10 f0       	push   $0xf0107933
f0104145:	e8 93 f6 ff ff       	call   f01037dd <cprintf>
f010414a:	83 c4 10             	add    $0x10,%esp
}
f010414d:	eb 8e                	jmp    f01040dd <print_trapframe+0x12e>

f010414f <page_fault_handler>:
}


void
page_fault_handler(struct Trapframe *tf)
{
f010414f:	f3 0f 1e fb          	endbr32 
f0104153:	55                   	push   %ebp
f0104154:	89 e5                	mov    %esp,%ebp
f0104156:	57                   	push   %edi
f0104157:	56                   	push   %esi
f0104158:	53                   	push   %ebx
f0104159:	83 ec 1c             	sub    $0x1c,%esp
f010415c:	8b 5d 08             	mov    0x8(%ebp),%ebx
f010415f:	0f 20 d0             	mov    %cr2,%eax
f0104162:	89 45 e4             	mov    %eax,-0x1c(%ebp)
	fault_va = rcr2();

	// Handle kernel-mode page faults.

	// LAB 3: Your code here.
	if ((tf->tf_cs & 3) == 0) //内核态发生缺页中断直接panic
f0104165:	f6 43 34 03          	testb  $0x3,0x34(%ebx)
f0104169:	74 5f                	je     f01041ca <page_fault_handler+0x7b>
	//   user_mem_assert() and env_run() are useful here.
	//   To change what the user environment runs, modify 'curenv->env_tf'
	//   (the 'tf' variable points at 'curenv->env_tf').

	// LAB 4: Your code here.
	if(curenv->env_pgfault_upcall){
f010416b:	e8 9a 1d 00 00       	call   f0105f0a <cpunum>
f0104170:	6b c0 74             	imul   $0x74,%eax,%eax
f0104173:	8b 80 28 80 21 f0    	mov    -0xfde7fd8(%eax),%eax
f0104179:	83 78 64 00          	cmpl   $0x0,0x64(%eax)
f010417d:	75 62                	jne    f01041e1 <page_fault_handler+0x92>
		env_run(curenv);	//转入env_pgfault_upcall执行【权限为用户态】，在异常栈帧上执行。

	}

	// Destroy the environment that caused the fault.
	cprintf("[%08x] user fault va %08x ip %08x\n",
f010417f:	8b 73 30             	mov    0x30(%ebx),%esi
		curenv->env_id, fault_va, tf->tf_eip);
f0104182:	e8 83 1d 00 00       	call   f0105f0a <cpunum>
	cprintf("[%08x] user fault va %08x ip %08x\n",
f0104187:	56                   	push   %esi
f0104188:	ff 75 e4             	pushl  -0x1c(%ebp)
		curenv->env_id, fault_va, tf->tf_eip);
f010418b:	6b c0 74             	imul   $0x74,%eax,%eax
	cprintf("[%08x] user fault va %08x ip %08x\n",
f010418e:	8b 80 28 80 21 f0    	mov    -0xfde7fd8(%eax),%eax
f0104194:	ff 70 48             	pushl  0x48(%eax)
f0104197:	68 20 7b 10 f0       	push   $0xf0107b20
f010419c:	e8 3c f6 ff ff       	call   f01037dd <cprintf>
	print_trapframe(tf);
f01041a1:	89 1c 24             	mov    %ebx,(%esp)
f01041a4:	e8 06 fe ff ff       	call   f0103faf <print_trapframe>
	env_destroy(curenv);
f01041a9:	e8 5c 1d 00 00       	call   f0105f0a <cpunum>
f01041ae:	83 c4 04             	add    $0x4,%esp
f01041b1:	6b c0 74             	imul   $0x74,%eax,%eax
f01041b4:	ff b0 28 80 21 f0    	pushl  -0xfde7fd8(%eax)
f01041ba:	e8 25 f3 ff ff       	call   f01034e4 <env_destroy>
}
f01041bf:	83 c4 10             	add    $0x10,%esp
f01041c2:	8d 65 f4             	lea    -0xc(%ebp),%esp
f01041c5:	5b                   	pop    %ebx
f01041c6:	5e                   	pop    %esi
f01041c7:	5f                   	pop    %edi
f01041c8:	5d                   	pop    %ebp
f01041c9:	c3                   	ret    
		panic("page_fault_handler():page fault in kernel mode!\n");
f01041ca:	83 ec 04             	sub    $0x4,%esp
f01041cd:	68 ec 7a 10 f0       	push   $0xf0107aec
f01041d2:	68 89 01 00 00       	push   $0x189
f01041d7:	68 46 79 10 f0       	push   $0xf0107946
f01041dc:	e8 5f be ff ff       	call   f0100040 <_panic>
		if(tf->tf_esp>=UXSTACKTOP-PGSIZE&&tf->tf_esp<=(UXSTACKTOP-1)){
f01041e1:	8b 43 3c             	mov    0x3c(%ebx),%eax
f01041e4:	8d 90 00 10 40 11    	lea    0x11401000(%eax),%edx
			utf = (struct UTrapframe *)(UXSTACKTOP  - sizeof(struct UTrapframe));
f01041ea:	bf cc ff bf ee       	mov    $0xeebfffcc,%edi
		if(tf->tf_esp>=UXSTACKTOP-PGSIZE&&tf->tf_esp<=(UXSTACKTOP-1)){
f01041ef:	81 fa ff 0f 00 00    	cmp    $0xfff,%edx
f01041f5:	77 05                	ja     f01041fc <page_fault_handler+0xad>
			utf = (struct UTrapframe *)(tf->tf_esp - 4 - sizeof(struct UTrapframe));
f01041f7:	83 e8 38             	sub    $0x38,%eax
f01041fa:	89 c7                	mov    %eax,%edi
		user_mem_assert(curenv,(void *)utf,1,PTE_W);
f01041fc:	e8 09 1d 00 00       	call   f0105f0a <cpunum>
f0104201:	6a 02                	push   $0x2
f0104203:	6a 01                	push   $0x1
f0104205:	57                   	push   %edi
f0104206:	6b c0 74             	imul   $0x74,%eax,%eax
f0104209:	ff b0 28 80 21 f0    	pushl  -0xfde7fd8(%eax)
f010420f:	e8 b4 ec ff ff       	call   f0102ec8 <user_mem_assert>
		utf->utf_esp = tf->tf_esp;
f0104214:	8b 43 3c             	mov    0x3c(%ebx),%eax
f0104217:	89 47 30             	mov    %eax,0x30(%edi)
		utf->utf_eflags = tf->tf_eflags;
f010421a:	8b 43 38             	mov    0x38(%ebx),%eax
f010421d:	89 fa                	mov    %edi,%edx
f010421f:	89 47 2c             	mov    %eax,0x2c(%edi)
		utf->utf_eip = tf->tf_eip;
f0104222:	8b 43 30             	mov    0x30(%ebx),%eax
f0104225:	89 47 28             	mov    %eax,0x28(%edi)
		utf->utf_regs = tf->tf_regs;
f0104228:	8d 7f 08             	lea    0x8(%edi),%edi
f010422b:	b9 08 00 00 00       	mov    $0x8,%ecx
f0104230:	89 de                	mov    %ebx,%esi
f0104232:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
		utf->utf_err = tf->tf_err;
f0104234:	8b 43 2c             	mov    0x2c(%ebx),%eax
f0104237:	89 42 04             	mov    %eax,0x4(%edx)
		utf->utf_fault_va = fault_va;
f010423a:	89 d7                	mov    %edx,%edi
f010423c:	8b 45 e4             	mov    -0x1c(%ebp),%eax
f010423f:	89 02                	mov    %eax,(%edx)
		curenv->env_tf.tf_eip = (uintptr_t)curenv->env_pgfault_upcall;
f0104241:	e8 c4 1c 00 00       	call   f0105f0a <cpunum>
f0104246:	6b c0 74             	imul   $0x74,%eax,%eax
f0104249:	8b 80 28 80 21 f0    	mov    -0xfde7fd8(%eax),%eax
f010424f:	8b 58 64             	mov    0x64(%eax),%ebx
f0104252:	e8 b3 1c 00 00       	call   f0105f0a <cpunum>
f0104257:	6b c0 74             	imul   $0x74,%eax,%eax
f010425a:	8b 80 28 80 21 f0    	mov    -0xfde7fd8(%eax),%eax
f0104260:	89 58 30             	mov    %ebx,0x30(%eax)
		curenv->env_tf.tf_esp = (uintptr_t)utf;
f0104263:	e8 a2 1c 00 00       	call   f0105f0a <cpunum>
f0104268:	6b c0 74             	imul   $0x74,%eax,%eax
f010426b:	8b 80 28 80 21 f0    	mov    -0xfde7fd8(%eax),%eax
f0104271:	89 78 3c             	mov    %edi,0x3c(%eax)
		env_run(curenv);	//转入env_pgfault_upcall执行【权限为用户态】，在异常栈帧上执行。
f0104274:	e8 91 1c 00 00       	call   f0105f0a <cpunum>
f0104279:	83 c4 04             	add    $0x4,%esp
f010427c:	6b c0 74             	imul   $0x74,%eax,%eax
f010427f:	ff b0 28 80 21 f0    	pushl  -0xfde7fd8(%eax)
f0104285:	e8 01 f3 ff ff       	call   f010358b <env_run>

f010428a <trap>:
{
f010428a:	f3 0f 1e fb          	endbr32 
f010428e:	55                   	push   %ebp
f010428f:	89 e5                	mov    %esp,%ebp
f0104291:	57                   	push   %edi
f0104292:	56                   	push   %esi
f0104293:	8b 75 08             	mov    0x8(%ebp),%esi
	asm volatile("cld" ::: "cc");
f0104296:	fc                   	cld    
	if (panicstr)
f0104297:	83 3d 80 7e 21 f0 00 	cmpl   $0x0,0xf0217e80
f010429e:	74 01                	je     f01042a1 <trap+0x17>
		asm volatile("hlt");
f01042a0:	f4                   	hlt    
	if (xchg(&thiscpu->cpu_status, CPU_STARTED) == CPU_HALTED)
f01042a1:	e8 64 1c 00 00       	call   f0105f0a <cpunum>
f01042a6:	6b d0 74             	imul   $0x74,%eax,%edx
f01042a9:	83 c2 04             	add    $0x4,%edx
	asm volatile("lock; xchgl %0, %1"
f01042ac:	b8 01 00 00 00       	mov    $0x1,%eax
f01042b1:	f0 87 82 20 80 21 f0 	lock xchg %eax,-0xfde7fe0(%edx)
f01042b8:	83 f8 02             	cmp    $0x2,%eax
f01042bb:	0f 84 c2 00 00 00    	je     f0104383 <trap+0xf9>
	asm volatile("pushfl; popl %0" : "=r" (eflags));
f01042c1:	9c                   	pushf  
f01042c2:	58                   	pop    %eax
	assert(!(read_eflags() & FL_IF));
f01042c3:	f6 c4 02             	test   $0x2,%ah
f01042c6:	0f 85 cc 00 00 00    	jne    f0104398 <trap+0x10e>
	if ((tf->tf_cs & 3) == 3) {
f01042cc:	0f b7 46 34          	movzwl 0x34(%esi),%eax
f01042d0:	83 e0 03             	and    $0x3,%eax
f01042d3:	66 83 f8 03          	cmp    $0x3,%ax
f01042d7:	0f 84 d4 00 00 00    	je     f01043b1 <trap+0x127>
	last_tf = tf;
f01042dd:	89 35 60 7a 21 f0    	mov    %esi,0xf0217a60
	if(tf->tf_trapno==T_PGFLT){
f01042e3:	8b 46 28             	mov    0x28(%esi),%eax
f01042e6:	83 f8 0e             	cmp    $0xe,%eax
f01042e9:	0f 84 67 01 00 00    	je     f0104456 <trap+0x1cc>
	if (tf->tf_trapno == T_BRKPT) {
f01042ef:	83 f8 03             	cmp    $0x3,%eax
f01042f2:	0f 84 6f 01 00 00    	je     f0104467 <trap+0x1dd>
	if (tf->tf_trapno == T_SYSCALL) { //如果是系统调用，按照前文说的规则，从寄存器中取出系统调用号和五个参数，传给kern/syscall.c中的syscall()，并将返回值保存到tf->tf_regs.reg_eax
f01042f8:	83 f8 30             	cmp    $0x30,%eax
f01042fb:	0f 84 77 01 00 00    	je     f0104478 <trap+0x1ee>
	if (tf->tf_trapno == IRQ_OFFSET + IRQ_SPURIOUS) {
f0104301:	83 f8 27             	cmp    $0x27,%eax
f0104304:	0f 84 92 01 00 00    	je     f010449c <trap+0x212>
	if(tf->tf_trapno == IRQ_OFFSET+IRQ_TIMER){
f010430a:	83 f8 20             	cmp    $0x20,%eax
f010430d:	0f 84 a6 01 00 00    	je     f01044b9 <trap+0x22f>
	if (tf->tf_trapno == IRQ_OFFSET + IRQ_KBD){
f0104313:	83 f8 21             	cmp    $0x21,%eax
f0104316:	0f 84 a7 01 00 00    	je     f01044c3 <trap+0x239>
    else if (tf->tf_trapno == IRQ_OFFSET + IRQ_SERIAL){
f010431c:	83 f8 24             	cmp    $0x24,%eax
f010431f:	0f 84 a8 01 00 00    	je     f01044cd <trap+0x243>
	print_trapframe(tf);
f0104325:	83 ec 0c             	sub    $0xc,%esp
f0104328:	56                   	push   %esi
f0104329:	e8 81 fc ff ff       	call   f0103faf <print_trapframe>
	if (tf->tf_cs == GD_KT)
f010432e:	83 c4 10             	add    $0x10,%esp
f0104331:	66 83 7e 34 08       	cmpw   $0x8,0x34(%esi)
f0104336:	0f 84 9b 01 00 00    	je     f01044d7 <trap+0x24d>
		env_destroy(curenv);
f010433c:	e8 c9 1b 00 00       	call   f0105f0a <cpunum>
f0104341:	83 ec 0c             	sub    $0xc,%esp
f0104344:	6b c0 74             	imul   $0x74,%eax,%eax
f0104347:	ff b0 28 80 21 f0    	pushl  -0xfde7fd8(%eax)
f010434d:	e8 92 f1 ff ff       	call   f01034e4 <env_destroy>
		return;
f0104352:	83 c4 10             	add    $0x10,%esp
	if (curenv && curenv->env_status == ENV_RUNNING)
f0104355:	e8 b0 1b 00 00       	call   f0105f0a <cpunum>
f010435a:	6b c0 74             	imul   $0x74,%eax,%eax
f010435d:	83 b8 28 80 21 f0 00 	cmpl   $0x0,-0xfde7fd8(%eax)
f0104364:	74 18                	je     f010437e <trap+0xf4>
f0104366:	e8 9f 1b 00 00       	call   f0105f0a <cpunum>
f010436b:	6b c0 74             	imul   $0x74,%eax,%eax
f010436e:	8b 80 28 80 21 f0    	mov    -0xfde7fd8(%eax),%eax
f0104374:	83 78 54 03          	cmpl   $0x3,0x54(%eax)
f0104378:	0f 84 70 01 00 00    	je     f01044ee <trap+0x264>
		sched_yield();
f010437e:	e8 6d 03 00 00       	call   f01046f0 <sched_yield>
	spin_lock(&kernel_lock);
f0104383:	83 ec 0c             	sub    $0xc,%esp
f0104386:	68 c0 33 12 f0       	push   $0xf01233c0
f010438b:	e8 02 1e 00 00       	call   f0106192 <spin_lock>
}
f0104390:	83 c4 10             	add    $0x10,%esp
f0104393:	e9 29 ff ff ff       	jmp    f01042c1 <trap+0x37>
	assert(!(read_eflags() & FL_IF));
f0104398:	68 52 79 10 f0       	push   $0xf0107952
f010439d:	68 47 74 10 f0       	push   $0xf0107447
f01043a2:	68 51 01 00 00       	push   $0x151
f01043a7:	68 46 79 10 f0       	push   $0xf0107946
f01043ac:	e8 8f bc ff ff       	call   f0100040 <_panic>
	spin_lock(&kernel_lock);
f01043b1:	83 ec 0c             	sub    $0xc,%esp
f01043b4:	68 c0 33 12 f0       	push   $0xf01233c0
f01043b9:	e8 d4 1d 00 00       	call   f0106192 <spin_lock>
		assert(curenv);
f01043be:	e8 47 1b 00 00       	call   f0105f0a <cpunum>
f01043c3:	6b c0 74             	imul   $0x74,%eax,%eax
f01043c6:	83 c4 10             	add    $0x10,%esp
f01043c9:	83 b8 28 80 21 f0 00 	cmpl   $0x0,-0xfde7fd8(%eax)
f01043d0:	74 3e                	je     f0104410 <trap+0x186>
		if (curenv->env_status == ENV_DYING) {
f01043d2:	e8 33 1b 00 00       	call   f0105f0a <cpunum>
f01043d7:	6b c0 74             	imul   $0x74,%eax,%eax
f01043da:	8b 80 28 80 21 f0    	mov    -0xfde7fd8(%eax),%eax
f01043e0:	83 78 54 01          	cmpl   $0x1,0x54(%eax)
f01043e4:	74 43                	je     f0104429 <trap+0x19f>
		curenv->env_tf = *tf;
f01043e6:	e8 1f 1b 00 00       	call   f0105f0a <cpunum>
f01043eb:	6b c0 74             	imul   $0x74,%eax,%eax
f01043ee:	8b 80 28 80 21 f0    	mov    -0xfde7fd8(%eax),%eax
f01043f4:	b9 11 00 00 00       	mov    $0x11,%ecx
f01043f9:	89 c7                	mov    %eax,%edi
f01043fb:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
		tf = &curenv->env_tf;
f01043fd:	e8 08 1b 00 00       	call   f0105f0a <cpunum>
f0104402:	6b c0 74             	imul   $0x74,%eax,%eax
f0104405:	8b b0 28 80 21 f0    	mov    -0xfde7fd8(%eax),%esi
f010440b:	e9 cd fe ff ff       	jmp    f01042dd <trap+0x53>
		assert(curenv);
f0104410:	68 6b 79 10 f0       	push   $0xf010796b
f0104415:	68 47 74 10 f0       	push   $0xf0107447
f010441a:	68 5a 01 00 00       	push   $0x15a
f010441f:	68 46 79 10 f0       	push   $0xf0107946
f0104424:	e8 17 bc ff ff       	call   f0100040 <_panic>
			env_free(curenv);
f0104429:	e8 dc 1a 00 00       	call   f0105f0a <cpunum>
f010442e:	83 ec 0c             	sub    $0xc,%esp
f0104431:	6b c0 74             	imul   $0x74,%eax,%eax
f0104434:	ff b0 28 80 21 f0    	pushl  -0xfde7fd8(%eax)
f010443a:	e8 f7 ee ff ff       	call   f0103336 <env_free>
			curenv = NULL;
f010443f:	e8 c6 1a 00 00       	call   f0105f0a <cpunum>
f0104444:	6b c0 74             	imul   $0x74,%eax,%eax
f0104447:	c7 80 28 80 21 f0 00 	movl   $0x0,-0xfde7fd8(%eax)
f010444e:	00 00 00 
			sched_yield();
f0104451:	e8 9a 02 00 00       	call   f01046f0 <sched_yield>
		page_fault_handler(tf);
f0104456:	83 ec 0c             	sub    $0xc,%esp
f0104459:	56                   	push   %esi
f010445a:	e8 f0 fc ff ff       	call   f010414f <page_fault_handler>
		return;
f010445f:	83 c4 10             	add    $0x10,%esp
f0104462:	e9 ee fe ff ff       	jmp    f0104355 <trap+0xcb>
		monitor(tf);
f0104467:	83 ec 0c             	sub    $0xc,%esp
f010446a:	56                   	push   %esi
f010446b:	e8 56 c4 ff ff       	call   f01008c6 <monitor>
		return;
f0104470:	83 c4 10             	add    $0x10,%esp
f0104473:	e9 dd fe ff ff       	jmp    f0104355 <trap+0xcb>
		tf->tf_regs.reg_eax = syscall(tf->tf_regs.reg_eax, tf->tf_regs.reg_edx, tf->tf_regs.reg_ecx,
f0104478:	83 ec 08             	sub    $0x8,%esp
f010447b:	ff 76 04             	pushl  0x4(%esi)
f010447e:	ff 36                	pushl  (%esi)
f0104480:	ff 76 10             	pushl  0x10(%esi)
f0104483:	ff 76 18             	pushl  0x18(%esi)
f0104486:	ff 76 14             	pushl  0x14(%esi)
f0104489:	ff 76 1c             	pushl  0x1c(%esi)
f010448c:	e8 0a 03 00 00       	call   f010479b <syscall>
f0104491:	89 46 1c             	mov    %eax,0x1c(%esi)
		return;
f0104494:	83 c4 20             	add    $0x20,%esp
f0104497:	e9 b9 fe ff ff       	jmp    f0104355 <trap+0xcb>
		cprintf("Spurious interrupt on irq 7\n");
f010449c:	83 ec 0c             	sub    $0xc,%esp
f010449f:	68 72 79 10 f0       	push   $0xf0107972
f01044a4:	e8 34 f3 ff ff       	call   f01037dd <cprintf>
		print_trapframe(tf);
f01044a9:	89 34 24             	mov    %esi,(%esp)
f01044ac:	e8 fe fa ff ff       	call   f0103faf <print_trapframe>
		return;
f01044b1:	83 c4 10             	add    $0x10,%esp
f01044b4:	e9 9c fe ff ff       	jmp    f0104355 <trap+0xcb>
	lapic_eoi();
f01044b9:	e8 9b 1b 00 00       	call   f0106059 <lapic_eoi>
	sched_yield();	//never return
f01044be:	e8 2d 02 00 00       	call   f01046f0 <sched_yield>
	kbd_intr();
f01044c3:	e8 35 c1 ff ff       	call   f01005fd <kbd_intr>
	return;
f01044c8:	e9 88 fe ff ff       	jmp    f0104355 <trap+0xcb>
	serial_intr();
f01044cd:	e8 0b c1 ff ff       	call   f01005dd <serial_intr>
	return;
f01044d2:	e9 7e fe ff ff       	jmp    f0104355 <trap+0xcb>
		panic("unhandled trap in kernel");
f01044d7:	83 ec 04             	sub    $0x4,%esp
f01044da:	68 8f 79 10 f0       	push   $0xf010798f
f01044df:	68 37 01 00 00       	push   $0x137
f01044e4:	68 46 79 10 f0       	push   $0xf0107946
f01044e9:	e8 52 bb ff ff       	call   f0100040 <_panic>
		env_run(curenv);
f01044ee:	e8 17 1a 00 00       	call   f0105f0a <cpunum>
f01044f3:	83 ec 0c             	sub    $0xc,%esp
f01044f6:	6b c0 74             	imul   $0x74,%eax,%eax
f01044f9:	ff b0 28 80 21 f0    	pushl  -0xfde7fd8(%eax)
f01044ff:	e8 87 f0 ff ff       	call   f010358b <env_run>

f0104504 <divide_handler>:
.text

/*
 * Lab 3: Your code here for generating entry points for the different traps.
 */
TRAPHANDLER_NOEC(divide_handler, T_DIVIDE);
f0104504:	6a 00                	push   $0x0
f0104506:	6a 00                	push   $0x0
f0104508:	e9 03 01 00 00       	jmp    f0104610 <_alltraps>
f010450d:	90                   	nop

f010450e <debug_handler>:
TRAPHANDLER_NOEC(debug_handler, T_DEBUG);
f010450e:	6a 00                	push   $0x0
f0104510:	6a 01                	push   $0x1
f0104512:	e9 f9 00 00 00       	jmp    f0104610 <_alltraps>
f0104517:	90                   	nop

f0104518 <nmi_handler>:
TRAPHANDLER_NOEC(nmi_handler, T_NMI);
f0104518:	6a 00                	push   $0x0
f010451a:	6a 02                	push   $0x2
f010451c:	e9 ef 00 00 00       	jmp    f0104610 <_alltraps>
f0104521:	90                   	nop

f0104522 <brkpt_handler>:
TRAPHANDLER_NOEC(brkpt_handler, T_BRKPT);
f0104522:	6a 00                	push   $0x0
f0104524:	6a 03                	push   $0x3
f0104526:	e9 e5 00 00 00       	jmp    f0104610 <_alltraps>
f010452b:	90                   	nop

f010452c <overflow_handler>:
TRAPHANDLER_NOEC(overflow_handler, T_OFLOW);
f010452c:	6a 00                	push   $0x0
f010452e:	6a 04                	push   $0x4
f0104530:	e9 db 00 00 00       	jmp    f0104610 <_alltraps>
f0104535:	90                   	nop

f0104536 <bounds_handler>:
TRAPHANDLER_NOEC(bounds_handler, T_BOUND);
f0104536:	6a 00                	push   $0x0
f0104538:	6a 05                	push   $0x5
f010453a:	e9 d1 00 00 00       	jmp    f0104610 <_alltraps>
f010453f:	90                   	nop

f0104540 <illegalop_handler>:
TRAPHANDLER_NOEC(illegalop_handler, T_ILLOP);
f0104540:	6a 00                	push   $0x0
f0104542:	6a 06                	push   $0x6
f0104544:	e9 c7 00 00 00       	jmp    f0104610 <_alltraps>
f0104549:	90                   	nop

f010454a <device_handler>:
TRAPHANDLER_NOEC(device_handler, T_DEVICE);
f010454a:	6a 00                	push   $0x0
f010454c:	6a 07                	push   $0x7
f010454e:	e9 bd 00 00 00       	jmp    f0104610 <_alltraps>
f0104553:	90                   	nop

f0104554 <double_handler>:

TRAPHANDLER(double_handler, T_DBLFLT);
f0104554:	6a 08                	push   $0x8
f0104556:	e9 b5 00 00 00       	jmp    f0104610 <_alltraps>
f010455b:	90                   	nop

f010455c <taskswitch_handler>:
TRAPHANDLER(taskswitch_handler, T_TSS);
f010455c:	6a 0a                	push   $0xa
f010455e:	e9 ad 00 00 00       	jmp    f0104610 <_alltraps>
f0104563:	90                   	nop

f0104564 <segment_handler>:
TRAPHANDLER(segment_handler, T_SEGNP);
f0104564:	6a 0b                	push   $0xb
f0104566:	e9 a5 00 00 00       	jmp    f0104610 <_alltraps>
f010456b:	90                   	nop

f010456c <stack_handler>:
TRAPHANDLER(stack_handler, T_STACK);
f010456c:	6a 0c                	push   $0xc
f010456e:	e9 9d 00 00 00       	jmp    f0104610 <_alltraps>
f0104573:	90                   	nop

f0104574 <protection_handler>:
TRAPHANDLER(protection_handler, T_GPFLT);
f0104574:	6a 0d                	push   $0xd
f0104576:	e9 95 00 00 00       	jmp    f0104610 <_alltraps>
f010457b:	90                   	nop

f010457c <page_handler>:
TRAPHANDLER(page_handler, T_PGFLT);
f010457c:	6a 0e                	push   $0xe
f010457e:	e9 8d 00 00 00       	jmp    f0104610 <_alltraps>
f0104583:	90                   	nop

f0104584 <floating_handler>:

TRAPHANDLER_NOEC(floating_handler, T_FPERR);
f0104584:	6a 00                	push   $0x0
f0104586:	6a 10                	push   $0x10
f0104588:	e9 83 00 00 00       	jmp    f0104610 <_alltraps>
f010458d:	90                   	nop

f010458e <aligment_handler>:
TRAPHANDLER_NOEC(aligment_handler, T_ALIGN);
f010458e:	6a 00                	push   $0x0
f0104590:	6a 11                	push   $0x11
f0104592:	eb 7c                	jmp    f0104610 <_alltraps>

f0104594 <machine_handler>:
TRAPHANDLER_NOEC(machine_handler, T_MCHK);
f0104594:	6a 00                	push   $0x0
f0104596:	6a 12                	push   $0x12
f0104598:	eb 76                	jmp    f0104610 <_alltraps>

f010459a <simd_handler>:
TRAPHANDLER_NOEC(simd_handler, T_SIMDERR);
f010459a:	6a 00                	push   $0x0
f010459c:	6a 13                	push   $0x13
f010459e:	eb 70                	jmp    f0104610 <_alltraps>

f01045a0 <syscall_handler>:
TRAPHANDLER_NOEC(syscall_handler, T_SYSCALL);
f01045a0:	6a 00                	push   $0x0
f01045a2:	6a 30                	push   $0x30
f01045a4:	eb 6a                	jmp    f0104610 <_alltraps>

f01045a6 <default_handler>:
TRAPHANDLER_NOEC(default_handler, T_DEFAULT);
f01045a6:	6a 00                	push   $0x0
f01045a8:	68 f4 01 00 00       	push   $0x1f4
f01045ad:	eb 61                	jmp    f0104610 <_alltraps>
f01045af:	90                   	nop

f01045b0 <IRQ0_Timer_handler>:

//以下是硬件中断。
TRAPHANDLER_NOEC(IRQ0_Timer_handler, IRQ_OFFSET + IRQ_TIMER);
f01045b0:	6a 00                	push   $0x0
f01045b2:	6a 20                	push   $0x20
f01045b4:	eb 5a                	jmp    f0104610 <_alltraps>

f01045b6 <IRQ1_Kbd_handler>:
TRAPHANDLER_NOEC(IRQ1_Kbd_handler, IRQ_OFFSET + IRQ_KBD);
f01045b6:	6a 00                	push   $0x0
f01045b8:	6a 21                	push   $0x21
f01045ba:	eb 54                	jmp    f0104610 <_alltraps>

f01045bc <IRQ_2>:
TRAPHANDLER_NOEC(IRQ_2, IRQ_OFFSET + 2);
f01045bc:	6a 00                	push   $0x0
f01045be:	6a 22                	push   $0x22
f01045c0:	eb 4e                	jmp    f0104610 <_alltraps>

f01045c2 <IRQ_3>:
TRAPHANDLER_NOEC(IRQ_3, IRQ_OFFSET + 3);
f01045c2:	6a 00                	push   $0x0
f01045c4:	6a 23                	push   $0x23
f01045c6:	eb 48                	jmp    f0104610 <_alltraps>

f01045c8 <IRQ4_Serial_handler>:
TRAPHANDLER_NOEC(IRQ4_Serial_handler, IRQ_OFFSET + IRQ_SERIAL);
f01045c8:	6a 00                	push   $0x0
f01045ca:	6a 24                	push   $0x24
f01045cc:	eb 42                	jmp    f0104610 <_alltraps>

f01045ce <IRQ_5>:
TRAPHANDLER_NOEC(IRQ_5, IRQ_OFFSET + 5);
f01045ce:	6a 00                	push   $0x0
f01045d0:	6a 25                	push   $0x25
f01045d2:	eb 3c                	jmp    f0104610 <_alltraps>

f01045d4 <IRQ_6>:
TRAPHANDLER_NOEC(IRQ_6, IRQ_OFFSET + 6);
f01045d4:	6a 00                	push   $0x0
f01045d6:	6a 26                	push   $0x26
f01045d8:	eb 36                	jmp    f0104610 <_alltraps>

f01045da <IRQ7_Spurious_handler>:
TRAPHANDLER_NOEC(IRQ7_Spurious_handler, IRQ_OFFSET + IRQ_SPURIOUS);
f01045da:	6a 00                	push   $0x0
f01045dc:	6a 27                	push   $0x27
f01045de:	eb 30                	jmp    f0104610 <_alltraps>

f01045e0 <IRQ_8>:
TRAPHANDLER_NOEC(IRQ_8, IRQ_OFFSET + 8);
f01045e0:	6a 00                	push   $0x0
f01045e2:	6a 28                	push   $0x28
f01045e4:	eb 2a                	jmp    f0104610 <_alltraps>

f01045e6 <IRQ_9>:
TRAPHANDLER_NOEC(IRQ_9, IRQ_OFFSET + 9);
f01045e6:	6a 00                	push   $0x0
f01045e8:	6a 29                	push   $0x29
f01045ea:	eb 24                	jmp    f0104610 <_alltraps>

f01045ec <IRQ_10>:
TRAPHANDLER_NOEC(IRQ_10, IRQ_OFFSET + 10);
f01045ec:	6a 00                	push   $0x0
f01045ee:	6a 2a                	push   $0x2a
f01045f0:	eb 1e                	jmp    f0104610 <_alltraps>

f01045f2 <IRQ_11>:
TRAPHANDLER_NOEC(IRQ_11, IRQ_OFFSET + 11);
f01045f2:	6a 00                	push   $0x0
f01045f4:	6a 2b                	push   $0x2b
f01045f6:	eb 18                	jmp    f0104610 <_alltraps>

f01045f8 <IRQ_12>:
TRAPHANDLER_NOEC(IRQ_12, IRQ_OFFSET + 12);
f01045f8:	6a 00                	push   $0x0
f01045fa:	6a 2c                	push   $0x2c
f01045fc:	eb 12                	jmp    f0104610 <_alltraps>

f01045fe <IRQ_13>:
TRAPHANDLER_NOEC(IRQ_13, IRQ_OFFSET + 13);
f01045fe:	6a 00                	push   $0x0
f0104600:	6a 2d                	push   $0x2d
f0104602:	eb 0c                	jmp    f0104610 <_alltraps>

f0104604 <IRQ14_Ide_handler>:
TRAPHANDLER_NOEC(IRQ14_Ide_handler, IRQ_OFFSET + IRQ_IDE);
f0104604:	6a 00                	push   $0x0
f0104606:	6a 2e                	push   $0x2e
f0104608:	eb 06                	jmp    f0104610 <_alltraps>

f010460a <IRQ_15>:
TRAPHANDLER_NOEC(IRQ_15, IRQ_OFFSET + 15);
f010460a:	6a 00                	push   $0x0
f010460c:	6a 2f                	push   $0x2f
f010460e:	eb 00                	jmp    f0104610 <_alltraps>

f0104610 <_alltraps>:
/*
 * Lab 3: Your code here for _alltraps
 */
_alltraps:
 // make the stack look like a struct Trapframe	
    pushl %ds;	pushl %es;	pushal;
f0104610:	1e                   	push   %ds
f0104611:	06                   	push   %es
f0104612:	60                   	pusha  
    // 实验指导书要求:load GD_KD into %ds and %es	
    movl $GD_KD, %edx	
f0104613:	ba 10 00 00 00       	mov    $0x10,%edx
    movl %edx, %ds	
f0104618:	8e da                	mov    %edx,%ds
    movl %edx, %es
f010461a:	8e c2                	mov    %edx,%es
    // 实验指导书要求:push %esp as an argument to trap()	
    pushl %esp;	call trap;
f010461c:	54                   	push   %esp
f010461d:	e8 68 fc ff ff       	call   f010428a <trap>

f0104622 <sched_halt>:
// Halt this CPU when there is nothing to do. Wait until the
// timer interrupt wakes it up. This function never returns.
//
void
sched_halt(void)
{
f0104622:	f3 0f 1e fb          	endbr32 
f0104626:	55                   	push   %ebp
f0104627:	89 e5                	mov    %esp,%ebp
f0104629:	83 ec 08             	sub    $0x8,%esp
f010462c:	a1 48 72 21 f0       	mov    0xf0217248,%eax
f0104631:	8d 50 54             	lea    0x54(%eax),%edx
	int i;

	// For debugging and testing purposes, if there are no runnable
	// environments in the system, then drop into the kernel monitor.
	for (i = 0; i < NENV; i++) {
f0104634:	b9 00 00 00 00       	mov    $0x0,%ecx
		if ((envs[i].env_status == ENV_RUNNABLE ||
		     envs[i].env_status == ENV_RUNNING ||
f0104639:	8b 02                	mov    (%edx),%eax
f010463b:	83 e8 01             	sub    $0x1,%eax
		if ((envs[i].env_status == ENV_RUNNABLE ||
f010463e:	83 f8 02             	cmp    $0x2,%eax
f0104641:	76 2d                	jbe    f0104670 <sched_halt+0x4e>
	for (i = 0; i < NENV; i++) {
f0104643:	83 c1 01             	add    $0x1,%ecx
f0104646:	83 c2 7c             	add    $0x7c,%edx
f0104649:	81 f9 00 04 00 00    	cmp    $0x400,%ecx
f010464f:	75 e8                	jne    f0104639 <sched_halt+0x17>
		     envs[i].env_status == ENV_DYING))
			break;
	}
	if (i == NENV) {
		cprintf("No runnable environments in the system!\n");
f0104651:	83 ec 0c             	sub    $0xc,%esp
f0104654:	68 b0 7b 10 f0       	push   $0xf0107bb0
f0104659:	e8 7f f1 ff ff       	call   f01037dd <cprintf>
f010465e:	83 c4 10             	add    $0x10,%esp
		while (1)
			monitor(NULL);
f0104661:	83 ec 0c             	sub    $0xc,%esp
f0104664:	6a 00                	push   $0x0
f0104666:	e8 5b c2 ff ff       	call   f01008c6 <monitor>
f010466b:	83 c4 10             	add    $0x10,%esp
f010466e:	eb f1                	jmp    f0104661 <sched_halt+0x3f>
	}

	// Mark that no environment is running on this CPU
	curenv = NULL;
f0104670:	e8 95 18 00 00       	call   f0105f0a <cpunum>
f0104675:	6b c0 74             	imul   $0x74,%eax,%eax
f0104678:	c7 80 28 80 21 f0 00 	movl   $0x0,-0xfde7fd8(%eax)
f010467f:	00 00 00 
	lcr3(PADDR(kern_pgdir));
f0104682:	a1 8c 7e 21 f0       	mov    0xf0217e8c,%eax
	if ((uint32_t)kva < KERNBASE)
f0104687:	3d ff ff ff ef       	cmp    $0xefffffff,%eax
f010468c:	76 50                	jbe    f01046de <sched_halt+0xbc>
	return (physaddr_t)kva - KERNBASE;
f010468e:	05 00 00 00 10       	add    $0x10000000,%eax
	asm volatile("movl %0,%%cr3" : : "r" (val));
f0104693:	0f 22 d8             	mov    %eax,%cr3

	// Mark that this CPU is in the HALT state, so that when
	// timer interupts come in, we know we should re-acquire the
	// big kernel lock
	xchg(&thiscpu->cpu_status, CPU_HALTED);
f0104696:	e8 6f 18 00 00       	call   f0105f0a <cpunum>
f010469b:	6b d0 74             	imul   $0x74,%eax,%edx
f010469e:	83 c2 04             	add    $0x4,%edx
	asm volatile("lock; xchgl %0, %1"
f01046a1:	b8 02 00 00 00       	mov    $0x2,%eax
f01046a6:	f0 87 82 20 80 21 f0 	lock xchg %eax,-0xfde7fe0(%edx)
	spin_unlock(&kernel_lock);
f01046ad:	83 ec 0c             	sub    $0xc,%esp
f01046b0:	68 c0 33 12 f0       	push   $0xf01233c0
f01046b5:	e8 76 1b 00 00       	call   f0106230 <spin_unlock>
	asm volatile("pause");
f01046ba:	f3 90                	pause  
		// Uncomment the following line after completing exercise 13
		"sti\n"
		"1:\n"
		"hlt\n"
		"jmp 1b\n"
	: : "a" (thiscpu->cpu_ts.ts_esp0));
f01046bc:	e8 49 18 00 00       	call   f0105f0a <cpunum>
f01046c1:	6b c0 74             	imul   $0x74,%eax,%eax
	asm volatile (
f01046c4:	8b 80 30 80 21 f0    	mov    -0xfde7fd0(%eax),%eax
f01046ca:	bd 00 00 00 00       	mov    $0x0,%ebp
f01046cf:	89 c4                	mov    %eax,%esp
f01046d1:	6a 00                	push   $0x0
f01046d3:	6a 00                	push   $0x0
f01046d5:	fb                   	sti    
f01046d6:	f4                   	hlt    
f01046d7:	eb fd                	jmp    f01046d6 <sched_halt+0xb4>
}
f01046d9:	83 c4 10             	add    $0x10,%esp
f01046dc:	c9                   	leave  
f01046dd:	c3                   	ret    
		_panic(file, line, "PADDR called with invalid kva %08lx", kva);
f01046de:	50                   	push   %eax
f01046df:	68 c8 65 10 f0       	push   $0xf01065c8
f01046e4:	6a 4a                	push   $0x4a
f01046e6:	68 d9 7b 10 f0       	push   $0xf0107bd9
f01046eb:	e8 50 b9 ff ff       	call   f0100040 <_panic>

f01046f0 <sched_yield>:
{
f01046f0:	f3 0f 1e fb          	endbr32 
f01046f4:	55                   	push   %ebp
f01046f5:	89 e5                	mov    %esp,%ebp
f01046f7:	53                   	push   %ebx
f01046f8:	83 ec 04             	sub    $0x4,%esp
	uint32_t curenvIdx = curenv?ENVX(curenv->env_id):0;
f01046fb:	e8 0a 18 00 00       	call   f0105f0a <cpunum>
f0104700:	6b c0 74             	imul   $0x74,%eax,%eax
f0104703:	ba 00 00 00 00       	mov    $0x0,%edx
f0104708:	83 b8 28 80 21 f0 00 	cmpl   $0x0,-0xfde7fd8(%eax)
f010470f:	74 17                	je     f0104728 <sched_yield+0x38>
f0104711:	e8 f4 17 00 00       	call   f0105f0a <cpunum>
f0104716:	6b c0 74             	imul   $0x74,%eax,%eax
f0104719:	8b 80 28 80 21 f0    	mov    -0xfde7fd8(%eax),%eax
f010471f:	8b 50 48             	mov    0x48(%eax),%edx
f0104722:	81 e2 ff 03 00 00    	and    $0x3ff,%edx
		if (envs[nextidx].env_status == ENV_RUNNABLE)
f0104728:	8b 0d 48 72 21 f0    	mov    0xf0217248,%ecx
f010472e:	8d 9a 00 04 00 00    	lea    0x400(%edx),%ebx
		uint32_t nextidx = (curenvIdx + offset)%NENV;
f0104734:	89 d0                	mov    %edx,%eax
f0104736:	25 ff 03 00 00       	and    $0x3ff,%eax
		if (envs[nextidx].env_status == ENV_RUNNABLE)
f010473b:	6b c0 7c             	imul   $0x7c,%eax,%eax
f010473e:	01 c8                	add    %ecx,%eax
f0104740:	83 78 54 02          	cmpl   $0x2,0x54(%eax)
f0104744:	74 36                	je     f010477c <sched_yield+0x8c>
f0104746:	83 c2 01             	add    $0x1,%edx
	for(offset=0;offset<NENV;offset++){
f0104749:	39 da                	cmp    %ebx,%edx
f010474b:	75 e7                	jne    f0104734 <sched_yield+0x44>
	if(curenv && curenv->env_status==ENV_RUNNING){
f010474d:	e8 b8 17 00 00       	call   f0105f0a <cpunum>
f0104752:	6b c0 74             	imul   $0x74,%eax,%eax
f0104755:	83 b8 28 80 21 f0 00 	cmpl   $0x0,-0xfde7fd8(%eax)
f010475c:	74 14                	je     f0104772 <sched_yield+0x82>
f010475e:	e8 a7 17 00 00       	call   f0105f0a <cpunum>
f0104763:	6b c0 74             	imul   $0x74,%eax,%eax
f0104766:	8b 80 28 80 21 f0    	mov    -0xfde7fd8(%eax),%eax
f010476c:	83 78 54 03          	cmpl   $0x3,0x54(%eax)
f0104770:	74 13                	je     f0104785 <sched_yield+0x95>
	sched_halt();
f0104772:	e8 ab fe ff ff       	call   f0104622 <sched_halt>
}
f0104777:	8b 5d fc             	mov    -0x4(%ebp),%ebx
f010477a:	c9                   	leave  
f010477b:	c3                   	ret    
			env_run(&envs[nextidx]);
f010477c:	83 ec 0c             	sub    $0xc,%esp
f010477f:	50                   	push   %eax
f0104780:	e8 06 ee ff ff       	call   f010358b <env_run>
		env_run(curenv);
f0104785:	e8 80 17 00 00       	call   f0105f0a <cpunum>
f010478a:	83 ec 0c             	sub    $0xc,%esp
f010478d:	6b c0 74             	imul   $0x74,%eax,%eax
f0104790:	ff b0 28 80 21 f0    	pushl  -0xfde7fd8(%eax)
f0104796:	e8 f0 ed ff ff       	call   f010358b <env_run>

f010479b <syscall>:
}

// Dispatches to the correct kernel function, passing the arguments.
int32_t
syscall(uint32_t syscallno, uint32_t a1, uint32_t a2, uint32_t a3, uint32_t a4, uint32_t a5)
{
f010479b:	f3 0f 1e fb          	endbr32 
f010479f:	55                   	push   %ebp
f01047a0:	89 e5                	mov    %esp,%ebp
f01047a2:	57                   	push   %edi
f01047a3:	56                   	push   %esi
f01047a4:	53                   	push   %ebx
f01047a5:	83 ec 1c             	sub    $0x1c,%esp
f01047a8:	8b 45 08             	mov    0x8(%ebp),%eax
f01047ab:	83 f8 0d             	cmp    $0xd,%eax
f01047ae:	0f 87 3a 06 00 00    	ja     f0104dee <syscall+0x653>
f01047b4:	3e ff 24 85 38 7c 10 	notrack jmp *-0xfef83c8(,%eax,4)
f01047bb:	f0 
	if(curenv->env_tf.tf_cs & 3)
f01047bc:	e8 49 17 00 00       	call   f0105f0a <cpunum>
f01047c1:	6b c0 74             	imul   $0x74,%eax,%eax
f01047c4:	8b 80 28 80 21 f0    	mov    -0xfde7fd8(%eax),%eax
f01047ca:	f6 40 34 03          	testb  $0x3,0x34(%eax)
f01047ce:	75 25                	jne    f01047f5 <syscall+0x5a>
	cprintf("%.*s", len, s);
f01047d0:	83 ec 04             	sub    $0x4,%esp
f01047d3:	ff 75 0c             	pushl  0xc(%ebp)
f01047d6:	ff 75 10             	pushl  0x10(%ebp)
f01047d9:	68 e6 7b 10 f0       	push   $0xf0107be6
f01047de:	e8 fa ef ff ff       	call   f01037dd <cprintf>
}
f01047e3:	83 c4 10             	add    $0x10,%esp
	int32_t ret;

	switch (syscallno) {
		case SYS_cputs:
			sys_cputs((char *)a1, (size_t)a2);
			return 0;
f01047e6:	bb 00 00 00 00       	mov    $0x0,%ebx
			
	    default:
		return -E_INVAL;
	}
	
}
f01047eb:	89 d8                	mov    %ebx,%eax
f01047ed:	8d 65 f4             	lea    -0xc(%ebp),%esp
f01047f0:	5b                   	pop    %ebx
f01047f1:	5e                   	pop    %esi
f01047f2:	5f                   	pop    %edi
f01047f3:	5d                   	pop    %ebp
f01047f4:	c3                   	ret    
		user_mem_assert(curenv, s, len, PTE_P|PTE_U);
f01047f5:	e8 10 17 00 00       	call   f0105f0a <cpunum>
f01047fa:	6a 05                	push   $0x5
f01047fc:	ff 75 10             	pushl  0x10(%ebp)
f01047ff:	ff 75 0c             	pushl  0xc(%ebp)
f0104802:	6b c0 74             	imul   $0x74,%eax,%eax
f0104805:	ff b0 28 80 21 f0    	pushl  -0xfde7fd8(%eax)
f010480b:	e8 b8 e6 ff ff       	call   f0102ec8 <user_mem_assert>
f0104810:	83 c4 10             	add    $0x10,%esp
f0104813:	eb bb                	jmp    f01047d0 <syscall+0x35>
	return cons_getc();
f0104815:	e8 f9 bd ff ff       	call   f0100613 <cons_getc>
f010481a:	89 c3                	mov    %eax,%ebx
			return sys_cgetc();
f010481c:	eb cd                	jmp    f01047eb <syscall+0x50>
	return curenv->env_id;
f010481e:	e8 e7 16 00 00       	call   f0105f0a <cpunum>
f0104823:	6b c0 74             	imul   $0x74,%eax,%eax
f0104826:	8b 80 28 80 21 f0    	mov    -0xfde7fd8(%eax),%eax
f010482c:	8b 58 48             	mov    0x48(%eax),%ebx
			return sys_getenvid();
f010482f:	eb ba                	jmp    f01047eb <syscall+0x50>
	if ((r = envid2env(envid, &e, 1)) < 0)
f0104831:	83 ec 04             	sub    $0x4,%esp
f0104834:	6a 01                	push   $0x1
f0104836:	8d 45 e4             	lea    -0x1c(%ebp),%eax
f0104839:	50                   	push   %eax
f010483a:	ff 75 0c             	pushl  0xc(%ebp)
f010483d:	e8 41 e7 ff ff       	call   f0102f83 <envid2env>
f0104842:	89 c3                	mov    %eax,%ebx
f0104844:	83 c4 10             	add    $0x10,%esp
f0104847:	85 c0                	test   %eax,%eax
f0104849:	78 a0                	js     f01047eb <syscall+0x50>
	if (e == curenv)
f010484b:	e8 ba 16 00 00       	call   f0105f0a <cpunum>
f0104850:	8b 55 e4             	mov    -0x1c(%ebp),%edx
f0104853:	6b c0 74             	imul   $0x74,%eax,%eax
f0104856:	39 90 28 80 21 f0    	cmp    %edx,-0xfde7fd8(%eax)
f010485c:	74 3d                	je     f010489b <syscall+0x100>
		cprintf("[%08x] destroying %08x\n", curenv->env_id, e->env_id);
f010485e:	8b 5a 48             	mov    0x48(%edx),%ebx
f0104861:	e8 a4 16 00 00       	call   f0105f0a <cpunum>
f0104866:	83 ec 04             	sub    $0x4,%esp
f0104869:	53                   	push   %ebx
f010486a:	6b c0 74             	imul   $0x74,%eax,%eax
f010486d:	8b 80 28 80 21 f0    	mov    -0xfde7fd8(%eax),%eax
f0104873:	ff 70 48             	pushl  0x48(%eax)
f0104876:	68 06 7c 10 f0       	push   $0xf0107c06
f010487b:	e8 5d ef ff ff       	call   f01037dd <cprintf>
f0104880:	83 c4 10             	add    $0x10,%esp
	env_destroy(e);
f0104883:	83 ec 0c             	sub    $0xc,%esp
f0104886:	ff 75 e4             	pushl  -0x1c(%ebp)
f0104889:	e8 56 ec ff ff       	call   f01034e4 <env_destroy>
	return 0;
f010488e:	83 c4 10             	add    $0x10,%esp
f0104891:	bb 00 00 00 00       	mov    $0x0,%ebx
			return sys_env_destroy((envid_t)a1);
f0104896:	e9 50 ff ff ff       	jmp    f01047eb <syscall+0x50>
		cprintf("[%08x] exiting gracefully\n", curenv->env_id);
f010489b:	e8 6a 16 00 00       	call   f0105f0a <cpunum>
f01048a0:	83 ec 08             	sub    $0x8,%esp
f01048a3:	6b c0 74             	imul   $0x74,%eax,%eax
f01048a6:	8b 80 28 80 21 f0    	mov    -0xfde7fd8(%eax),%eax
f01048ac:	ff 70 48             	pushl  0x48(%eax)
f01048af:	68 eb 7b 10 f0       	push   $0xf0107beb
f01048b4:	e8 24 ef ff ff       	call   f01037dd <cprintf>
f01048b9:	83 c4 10             	add    $0x10,%esp
f01048bc:	eb c5                	jmp    f0104883 <syscall+0xe8>
	sched_yield();
f01048be:	e8 2d fe ff ff       	call   f01046f0 <sched_yield>
	if(envid2env(envid, &theEnv, 1) < 0)return -E_BAD_ENV;
f01048c3:	83 ec 04             	sub    $0x4,%esp
f01048c6:	6a 01                	push   $0x1
f01048c8:	8d 45 e4             	lea    -0x1c(%ebp),%eax
f01048cb:	50                   	push   %eax
f01048cc:	ff 75 0c             	pushl  0xc(%ebp)
f01048cf:	e8 af e6 ff ff       	call   f0102f83 <envid2env>
f01048d4:	83 c4 10             	add    $0x10,%esp
f01048d7:	85 c0                	test   %eax,%eax
f01048d9:	78 6f                	js     f010494a <syscall+0x1af>
	if((uintptr_t)va >= UTOP || ((uintptr_t)va & (PGSIZE - 1)))return -E_INVAL;
f01048db:	81 7d 10 ff ff bf ee 	cmpl   $0xeebfffff,0x10(%ebp)
f01048e2:	77 70                	ja     f0104954 <syscall+0x1b9>
f01048e4:	8b 45 10             	mov    0x10(%ebp),%eax
f01048e7:	25 ff 0f 00 00       	and    $0xfff,%eax
	if((perm & leastPerm) != leastPerm || (perm & (~PTE_SYSCALL)))return -E_INVAL; 
f01048ec:	8b 55 14             	mov    0x14(%ebp),%edx
f01048ef:	83 e2 05             	and    $0x5,%edx
f01048f2:	83 fa 05             	cmp    $0x5,%edx
f01048f5:	75 67                	jne    f010495e <syscall+0x1c3>
f01048f7:	8b 5d 14             	mov    0x14(%ebp),%ebx
f01048fa:	81 e3 f8 f1 ff ff    	and    $0xfffff1f8,%ebx
f0104900:	09 c3                	or     %eax,%ebx
f0104902:	75 64                	jne    f0104968 <syscall+0x1cd>
	if(!(pageInfo = page_alloc(ALLOC_ZERO)))return -E_NO_MEM;
f0104904:	83 ec 0c             	sub    $0xc,%esp
f0104907:	6a 01                	push   $0x1
f0104909:	e8 85 c5 ff ff       	call   f0100e93 <page_alloc>
f010490e:	89 c6                	mov    %eax,%esi
f0104910:	83 c4 10             	add    $0x10,%esp
f0104913:	85 c0                	test   %eax,%eax
f0104915:	74 5b                	je     f0104972 <syscall+0x1d7>
	if(page_insert(theEnv->env_pgdir, pageInfo, va, perm) < 0){
f0104917:	ff 75 14             	pushl  0x14(%ebp)
f010491a:	ff 75 10             	pushl  0x10(%ebp)
f010491d:	50                   	push   %eax
f010491e:	8b 45 e4             	mov    -0x1c(%ebp),%eax
f0104921:	ff 70 60             	pushl  0x60(%eax)
f0104924:	e8 30 c8 ff ff       	call   f0101159 <page_insert>
f0104929:	83 c4 10             	add    $0x10,%esp
f010492c:	85 c0                	test   %eax,%eax
f010492e:	0f 89 b7 fe ff ff    	jns    f01047eb <syscall+0x50>
		page_free(pageInfo);
f0104934:	83 ec 0c             	sub    $0xc,%esp
f0104937:	56                   	push   %esi
f0104938:	e8 cf c5 ff ff       	call   f0100f0c <page_free>
		return -E_NO_MEM;
f010493d:	83 c4 10             	add    $0x10,%esp
f0104940:	bb fc ff ff ff       	mov    $0xfffffffc,%ebx
f0104945:	e9 a1 fe ff ff       	jmp    f01047eb <syscall+0x50>
	if(envid2env(envid, &theEnv, 1) < 0)return -E_BAD_ENV;
f010494a:	bb fe ff ff ff       	mov    $0xfffffffe,%ebx
f010494f:	e9 97 fe ff ff       	jmp    f01047eb <syscall+0x50>
	if((uintptr_t)va >= UTOP || ((uintptr_t)va & (PGSIZE - 1)))return -E_INVAL;
f0104954:	bb fd ff ff ff       	mov    $0xfffffffd,%ebx
f0104959:	e9 8d fe ff ff       	jmp    f01047eb <syscall+0x50>
	if((perm & leastPerm) != leastPerm || (perm & (~PTE_SYSCALL)))return -E_INVAL; 
f010495e:	bb fd ff ff ff       	mov    $0xfffffffd,%ebx
f0104963:	e9 83 fe ff ff       	jmp    f01047eb <syscall+0x50>
f0104968:	bb fd ff ff ff       	mov    $0xfffffffd,%ebx
f010496d:	e9 79 fe ff ff       	jmp    f01047eb <syscall+0x50>
	if(!(pageInfo = page_alloc(ALLOC_ZERO)))return -E_NO_MEM;
f0104972:	bb fc ff ff ff       	mov    $0xfffffffc,%ebx
        return sys_page_alloc((envid_t)a1, (void * )a2, (int )a3);
f0104977:	e9 6f fe ff ff       	jmp    f01047eb <syscall+0x50>
	if(envid2env(srcenvid, &srcEnv, 1) < 0 || envid2env(dstenvid, &dstEnv, 1) < 0)return -E_BAD_ENV;
f010497c:	83 ec 04             	sub    $0x4,%esp
f010497f:	6a 01                	push   $0x1
f0104981:	8d 45 e0             	lea    -0x20(%ebp),%eax
f0104984:	50                   	push   %eax
f0104985:	ff 75 0c             	pushl  0xc(%ebp)
f0104988:	e8 f6 e5 ff ff       	call   f0102f83 <envid2env>
f010498d:	83 c4 10             	add    $0x10,%esp
f0104990:	85 c0                	test   %eax,%eax
f0104992:	0f 88 9b 00 00 00    	js     f0104a33 <syscall+0x298>
f0104998:	83 ec 04             	sub    $0x4,%esp
f010499b:	6a 01                	push   $0x1
f010499d:	8d 45 e4             	lea    -0x1c(%ebp),%eax
f01049a0:	50                   	push   %eax
f01049a1:	ff 75 14             	pushl  0x14(%ebp)
f01049a4:	e8 da e5 ff ff       	call   f0102f83 <envid2env>
f01049a9:	83 c4 10             	add    $0x10,%esp
f01049ac:	85 c0                	test   %eax,%eax
f01049ae:	0f 88 89 00 00 00    	js     f0104a3d <syscall+0x2a2>
	if((uintptr_t)srcva >= UTOP || (uintptr_t)dstva >= UTOP || ((uintptr_t)srcva & (PGSIZE - 1)) || ((uintptr_t)dstva & (PGSIZE - 1)))return -E_INVAL;
f01049b4:	81 7d 10 ff ff bf ee 	cmpl   $0xeebfffff,0x10(%ebp)
f01049bb:	0f 87 86 00 00 00    	ja     f0104a47 <syscall+0x2ac>
f01049c1:	81 7d 18 ff ff bf ee 	cmpl   $0xeebfffff,0x18(%ebp)
f01049c8:	77 7d                	ja     f0104a47 <syscall+0x2ac>
f01049ca:	8b 45 10             	mov    0x10(%ebp),%eax
f01049cd:	0b 45 18             	or     0x18(%ebp),%eax
f01049d0:	25 ff 0f 00 00       	and    $0xfff,%eax
	if((perm & leastPerm) != leastPerm || (perm & (~PTE_SYSCALL)))return -E_INVAL; // PTE_SYSCALL == PTE_U | PTE_P | PTE_AVAIL | PTE_W
f01049d5:	8b 55 1c             	mov    0x1c(%ebp),%edx
f01049d8:	83 e2 05             	and    $0x5,%edx
f01049db:	83 fa 05             	cmp    $0x5,%edx
f01049de:	75 71                	jne    f0104a51 <syscall+0x2b6>
f01049e0:	8b 55 1c             	mov    0x1c(%ebp),%edx
f01049e3:	81 e2 f8 f1 ff ff    	and    $0xfffff1f8,%edx
f01049e9:	09 c2                	or     %eax,%edx
f01049eb:	75 6e                	jne    f0104a5b <syscall+0x2c0>
	if(!(srcPageInfo = page_lookup(srcEnv->env_pgdir, srcva, &srcPte)))return -E_INVAL;
f01049ed:	83 ec 04             	sub    $0x4,%esp
f01049f0:	8d 45 dc             	lea    -0x24(%ebp),%eax
f01049f3:	50                   	push   %eax
f01049f4:	ff 75 10             	pushl  0x10(%ebp)
f01049f7:	8b 45 e0             	mov    -0x20(%ebp),%eax
f01049fa:	ff 70 60             	pushl  0x60(%eax)
f01049fd:	e8 72 c6 ff ff       	call   f0101074 <page_lookup>
f0104a02:	83 c4 10             	add    $0x10,%esp
f0104a05:	85 c0                	test   %eax,%eax
f0104a07:	74 5c                	je     f0104a65 <syscall+0x2ca>
	if((perm & PTE_W) && !((*srcPte) & PTE_W))return -E_INVAL;
f0104a09:	f6 45 1c 02          	testb  $0x2,0x1c(%ebp)
f0104a0d:	74 08                	je     f0104a17 <syscall+0x27c>
f0104a0f:	8b 55 dc             	mov    -0x24(%ebp),%edx
f0104a12:	f6 02 02             	testb  $0x2,(%edx)
f0104a15:	74 58                	je     f0104a6f <syscall+0x2d4>
	return page_insert(dstEnv->env_pgdir, srcPageInfo, dstva, perm);
f0104a17:	ff 75 1c             	pushl  0x1c(%ebp)
f0104a1a:	ff 75 18             	pushl  0x18(%ebp)
f0104a1d:	50                   	push   %eax
f0104a1e:	8b 45 e4             	mov    -0x1c(%ebp),%eax
f0104a21:	ff 70 60             	pushl  0x60(%eax)
f0104a24:	e8 30 c7 ff ff       	call   f0101159 <page_insert>
f0104a29:	89 c3                	mov    %eax,%ebx
f0104a2b:	83 c4 10             	add    $0x10,%esp
f0104a2e:	e9 b8 fd ff ff       	jmp    f01047eb <syscall+0x50>
	if(envid2env(srcenvid, &srcEnv, 1) < 0 || envid2env(dstenvid, &dstEnv, 1) < 0)return -E_BAD_ENV;
f0104a33:	bb fe ff ff ff       	mov    $0xfffffffe,%ebx
f0104a38:	e9 ae fd ff ff       	jmp    f01047eb <syscall+0x50>
f0104a3d:	bb fe ff ff ff       	mov    $0xfffffffe,%ebx
f0104a42:	e9 a4 fd ff ff       	jmp    f01047eb <syscall+0x50>
	if((uintptr_t)srcva >= UTOP || (uintptr_t)dstva >= UTOP || ((uintptr_t)srcva & (PGSIZE - 1)) || ((uintptr_t)dstva & (PGSIZE - 1)))return -E_INVAL;
f0104a47:	bb fd ff ff ff       	mov    $0xfffffffd,%ebx
f0104a4c:	e9 9a fd ff ff       	jmp    f01047eb <syscall+0x50>
	if((perm & leastPerm) != leastPerm || (perm & (~PTE_SYSCALL)))return -E_INVAL; // PTE_SYSCALL == PTE_U | PTE_P | PTE_AVAIL | PTE_W
f0104a51:	bb fd ff ff ff       	mov    $0xfffffffd,%ebx
f0104a56:	e9 90 fd ff ff       	jmp    f01047eb <syscall+0x50>
f0104a5b:	bb fd ff ff ff       	mov    $0xfffffffd,%ebx
f0104a60:	e9 86 fd ff ff       	jmp    f01047eb <syscall+0x50>
	if(!(srcPageInfo = page_lookup(srcEnv->env_pgdir, srcva, &srcPte)))return -E_INVAL;
f0104a65:	bb fd ff ff ff       	mov    $0xfffffffd,%ebx
f0104a6a:	e9 7c fd ff ff       	jmp    f01047eb <syscall+0x50>
	if((perm & PTE_W) && !((*srcPte) & PTE_W))return -E_INVAL;
f0104a6f:	bb fd ff ff ff       	mov    $0xfffffffd,%ebx
        return sys_page_map((envid_t) a1, (void *) a2, (envid_t) a3, (void *) a4, (int) a5);
f0104a74:	e9 72 fd ff ff       	jmp    f01047eb <syscall+0x50>
	if(envid2env(envid, &theEnv, 1) < 0)return -E_BAD_ENV;
f0104a79:	83 ec 04             	sub    $0x4,%esp
f0104a7c:	6a 01                	push   $0x1
f0104a7e:	8d 45 e4             	lea    -0x1c(%ebp),%eax
f0104a81:	50                   	push   %eax
f0104a82:	ff 75 0c             	pushl  0xc(%ebp)
f0104a85:	e8 f9 e4 ff ff       	call   f0102f83 <envid2env>
f0104a8a:	83 c4 10             	add    $0x10,%esp
f0104a8d:	85 c0                	test   %eax,%eax
f0104a8f:	78 30                	js     f0104ac1 <syscall+0x326>
	if((uintptr_t)va >= UTOP || (uintptr_t)va & (PGSIZE - 1))return -E_INVAL;
f0104a91:	81 7d 10 ff ff bf ee 	cmpl   $0xeebfffff,0x10(%ebp)
f0104a98:	77 31                	ja     f0104acb <syscall+0x330>
f0104a9a:	f7 45 10 ff 0f 00 00 	testl  $0xfff,0x10(%ebp)
f0104aa1:	75 32                	jne    f0104ad5 <syscall+0x33a>
	page_remove(theEnv->env_pgdir, va);
f0104aa3:	83 ec 08             	sub    $0x8,%esp
f0104aa6:	ff 75 10             	pushl  0x10(%ebp)
f0104aa9:	8b 45 e4             	mov    -0x1c(%ebp),%eax
f0104aac:	ff 70 60             	pushl  0x60(%eax)
f0104aaf:	e8 5b c6 ff ff       	call   f010110f <page_remove>
	return 0;
f0104ab4:	83 c4 10             	add    $0x10,%esp
f0104ab7:	bb 00 00 00 00       	mov    $0x0,%ebx
f0104abc:	e9 2a fd ff ff       	jmp    f01047eb <syscall+0x50>
	if(envid2env(envid, &theEnv, 1) < 0)return -E_BAD_ENV;
f0104ac1:	bb fe ff ff ff       	mov    $0xfffffffe,%ebx
f0104ac6:	e9 20 fd ff ff       	jmp    f01047eb <syscall+0x50>
	if((uintptr_t)va >= UTOP || (uintptr_t)va & (PGSIZE - 1))return -E_INVAL;
f0104acb:	bb fd ff ff ff       	mov    $0xfffffffd,%ebx
f0104ad0:	e9 16 fd ff ff       	jmp    f01047eb <syscall+0x50>
f0104ad5:	bb fd ff ff ff       	mov    $0xfffffffd,%ebx
        return sys_page_unmap((envid_t) a1, (void *) a2);
f0104ada:	e9 0c fd ff ff       	jmp    f01047eb <syscall+0x50>
	envid2env(0,&currentEnv,1);
f0104adf:	83 ec 04             	sub    $0x4,%esp
f0104ae2:	6a 01                	push   $0x1
f0104ae4:	8d 45 e4             	lea    -0x1c(%ebp),%eax
f0104ae7:	50                   	push   %eax
f0104ae8:	6a 00                	push   $0x0
f0104aea:	e8 94 e4 ff ff       	call   f0102f83 <envid2env>
	assert(currentEnv);
f0104aef:	8b 45 e4             	mov    -0x1c(%ebp),%eax
f0104af2:	83 c4 10             	add    $0x10,%esp
f0104af5:	85 c0                	test   %eax,%eax
f0104af7:	74 42                	je     f0104b3b <syscall+0x3a0>
	flag=env_alloc(&newEnv,currentEnv->env_id);
f0104af9:	83 ec 08             	sub    $0x8,%esp
f0104afc:	ff 70 48             	pushl  0x48(%eax)
f0104aff:	8d 45 e0             	lea    -0x20(%ebp),%eax
f0104b02:	50                   	push   %eax
f0104b03:	e8 89 e5 ff ff       	call   f0103091 <env_alloc>
f0104b08:	89 c3                	mov    %eax,%ebx
	if(flag<0)
f0104b0a:	83 c4 10             	add    $0x10,%esp
f0104b0d:	85 c0                	test   %eax,%eax
f0104b0f:	0f 88 d6 fc ff ff    	js     f01047eb <syscall+0x50>
	newEnv->env_tf=currentEnv->env_tf;
f0104b15:	8b 75 e4             	mov    -0x1c(%ebp),%esi
f0104b18:	b9 11 00 00 00       	mov    $0x11,%ecx
f0104b1d:	8b 7d e0             	mov    -0x20(%ebp),%edi
f0104b20:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
	newEnv->env_status=ENV_NOT_RUNNABLE;
f0104b22:	8b 45 e0             	mov    -0x20(%ebp),%eax
f0104b25:	c7 40 54 04 00 00 00 	movl   $0x4,0x54(%eax)
	newEnv->env_tf.tf_regs.reg_eax = 0;
f0104b2c:	c7 40 1c 00 00 00 00 	movl   $0x0,0x1c(%eax)
	return newEnv->env_id;
f0104b33:	8b 58 48             	mov    0x48(%eax),%ebx
        return sys_exofork();
f0104b36:	e9 b0 fc ff ff       	jmp    f01047eb <syscall+0x50>
	assert(currentEnv);
f0104b3b:	68 1e 7c 10 f0       	push   $0xf0107c1e
f0104b40:	68 47 74 10 f0       	push   $0xf0107447
f0104b45:	6a 5d                	push   $0x5d
f0104b47:	68 29 7c 10 f0       	push   $0xf0107c29
f0104b4c:	e8 ef b4 ff ff       	call   f0100040 <_panic>
	if(envid2env(envid, &theEnv, 1) < 0)return -E_BAD_ENV;	//注意这的最后一个参数checkperm要设置为1，检查修改这个env的进程是要么是这个env的父进程，要么就是env自己。不然不允许随便进行状态修改。
f0104b51:	83 ec 04             	sub    $0x4,%esp
f0104b54:	6a 01                	push   $0x1
f0104b56:	8d 45 e4             	lea    -0x1c(%ebp),%eax
f0104b59:	50                   	push   %eax
f0104b5a:	ff 75 0c             	pushl  0xc(%ebp)
f0104b5d:	e8 21 e4 ff ff       	call   f0102f83 <envid2env>
f0104b62:	83 c4 10             	add    $0x10,%esp
f0104b65:	85 c0                	test   %eax,%eax
f0104b67:	78 20                	js     f0104b89 <syscall+0x3ee>
	if(status != ENV_RUNNABLE && status != ENV_NOT_RUNNABLE)return -E_INVAL;
f0104b69:	8b 45 10             	mov    0x10(%ebp),%eax
f0104b6c:	83 e8 02             	sub    $0x2,%eax
f0104b6f:	a9 fd ff ff ff       	test   $0xfffffffd,%eax
f0104b74:	75 1d                	jne    f0104b93 <syscall+0x3f8>
	theEnv->env_status = status;
f0104b76:	8b 45 e4             	mov    -0x1c(%ebp),%eax
f0104b79:	8b 7d 10             	mov    0x10(%ebp),%edi
f0104b7c:	89 78 54             	mov    %edi,0x54(%eax)
	return 0;
f0104b7f:	bb 00 00 00 00       	mov    $0x0,%ebx
f0104b84:	e9 62 fc ff ff       	jmp    f01047eb <syscall+0x50>
	if(envid2env(envid, &theEnv, 1) < 0)return -E_BAD_ENV;	//注意这的最后一个参数checkperm要设置为1，检查修改这个env的进程是要么是这个env的父进程，要么就是env自己。不然不允许随便进行状态修改。
f0104b89:	bb fe ff ff ff       	mov    $0xfffffffe,%ebx
f0104b8e:	e9 58 fc ff ff       	jmp    f01047eb <syscall+0x50>
	if(status != ENV_RUNNABLE && status != ENV_NOT_RUNNABLE)return -E_INVAL;
f0104b93:	bb fd ff ff ff       	mov    $0xfffffffd,%ebx
		return sys_env_set_status((envid_t) a1, (int) a2);
f0104b98:	e9 4e fc ff ff       	jmp    f01047eb <syscall+0x50>
	int ret=envid2env(envid,&env,1);
f0104b9d:	83 ec 04             	sub    $0x4,%esp
f0104ba0:	6a 01                	push   $0x1
f0104ba2:	8d 45 e4             	lea    -0x1c(%ebp),%eax
f0104ba5:	50                   	push   %eax
f0104ba6:	ff 75 0c             	pushl  0xc(%ebp)
f0104ba9:	e8 d5 e3 ff ff       	call   f0102f83 <envid2env>
	if(ret<0){
f0104bae:	83 c4 10             	add    $0x10,%esp
f0104bb1:	85 c0                	test   %eax,%eax
f0104bb3:	78 13                	js     f0104bc8 <syscall+0x42d>
	env->env_pgfault_upcall=func;
f0104bb5:	8b 45 e4             	mov    -0x1c(%ebp),%eax
f0104bb8:	8b 4d 10             	mov    0x10(%ebp),%ecx
f0104bbb:	89 48 64             	mov    %ecx,0x64(%eax)
	return 0;
f0104bbe:	bb 00 00 00 00       	mov    $0x0,%ebx
f0104bc3:	e9 23 fc ff ff       	jmp    f01047eb <syscall+0x50>
		return -E_BAD_ENV;
f0104bc8:	bb fe ff ff ff       	mov    $0xfffffffe,%ebx
		return sys_env_set_pgfault_upcall((envid_t)a1,(void*)a2);
f0104bcd:	e9 19 fc ff ff       	jmp    f01047eb <syscall+0x50>
	envid2env(0,&currentEnv,0);
f0104bd2:	83 ec 04             	sub    $0x4,%esp
f0104bd5:	6a 00                	push   $0x0
f0104bd7:	8d 45 e0             	lea    -0x20(%ebp),%eax
f0104bda:	50                   	push   %eax
f0104bdb:	6a 00                	push   $0x0
f0104bdd:	e8 a1 e3 ff ff       	call   f0102f83 <envid2env>
	assert(currentEnv);
f0104be2:	83 c4 10             	add    $0x10,%esp
f0104be5:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
f0104be9:	0f 84 d5 00 00 00    	je     f0104cc4 <syscall+0x529>
	if((error = envid2env(envid,&receiveEnv,0))<0)
f0104bef:	83 ec 04             	sub    $0x4,%esp
f0104bf2:	6a 00                	push   $0x0
f0104bf4:	8d 45 dc             	lea    -0x24(%ebp),%eax
f0104bf7:	50                   	push   %eax
f0104bf8:	ff 75 0c             	pushl  0xc(%ebp)
f0104bfb:	e8 83 e3 ff ff       	call   f0102f83 <envid2env>
f0104c00:	89 c3                	mov    %eax,%ebx
f0104c02:	83 c4 10             	add    $0x10,%esp
f0104c05:	85 c0                	test   %eax,%eax
f0104c07:	0f 88 de fb ff ff    	js     f01047eb <syscall+0x50>
	if(!receiveEnv->env_ipc_recving)	
f0104c0d:	8b 45 dc             	mov    -0x24(%ebp),%eax
f0104c10:	80 78 68 00          	cmpb   $0x0,0x68(%eax)
f0104c14:	0f 84 e8 00 00 00    	je     f0104d02 <syscall+0x567>
	if((uintptr_t)srcva<UTOP){
f0104c1a:	81 7d 14 ff ff bf ee 	cmpl   $0xeebfffff,0x14(%ebp)
f0104c21:	77 6d                	ja     f0104c90 <syscall+0x4f5>
		if((uint32_t)(leastPerm&perm)!=leastPerm || (perm&(~PTE_SYSCALL)))
f0104c23:	8b 45 18             	mov    0x18(%ebp),%eax
f0104c26:	83 e0 05             	and    $0x5,%eax
			return -E_INVAL;
f0104c29:	bb fd ff ff ff       	mov    $0xfffffffd,%ebx
		if((uint32_t)(leastPerm&perm)!=leastPerm || (perm&(~PTE_SYSCALL)))
f0104c2e:	83 f8 05             	cmp    $0x5,%eax
f0104c31:	0f 85 b4 fb ff ff    	jne    f01047eb <syscall+0x50>
		if((uintptr_t)srcva&(PGSIZE-1))
f0104c37:	8b 55 14             	mov    0x14(%ebp),%edx
f0104c3a:	81 e2 ff 0f 00 00    	and    $0xfff,%edx
		if((uint32_t)(leastPerm&perm)!=leastPerm || (perm&(~PTE_SYSCALL)))
f0104c40:	8b 45 18             	mov    0x18(%ebp),%eax
f0104c43:	25 f8 f1 ff ff       	and    $0xfffff1f8,%eax
f0104c48:	09 c2                	or     %eax,%edx
f0104c4a:	0f 85 9b fb ff ff    	jne    f01047eb <syscall+0x50>
		if(!(pageinfo = page_lookup(currentEnv->env_pgdir,srcva,&pte)))
f0104c50:	83 ec 04             	sub    $0x4,%esp
f0104c53:	8d 45 e4             	lea    -0x1c(%ebp),%eax
f0104c56:	50                   	push   %eax
f0104c57:	ff 75 14             	pushl  0x14(%ebp)
f0104c5a:	8b 45 e0             	mov    -0x20(%ebp),%eax
f0104c5d:	ff 70 60             	pushl  0x60(%eax)
f0104c60:	e8 0f c4 ff ff       	call   f0101074 <page_lookup>
f0104c65:	83 c4 10             	add    $0x10,%esp
f0104c68:	85 c0                	test   %eax,%eax
f0104c6a:	0f 84 88 00 00 00    	je     f0104cf8 <syscall+0x55d>
		if((perm&PTE_W)&&!((*pte)&PTE_W))
f0104c70:	f6 45 18 02          	testb  $0x2,0x18(%ebp)
f0104c74:	74 0c                	je     f0104c82 <syscall+0x4e7>
f0104c76:	8b 55 e4             	mov    -0x1c(%ebp),%edx
f0104c79:	f6 02 02             	testb  $0x2,(%edx)
f0104c7c:	0f 84 69 fb ff ff    	je     f01047eb <syscall+0x50>
		if ((uintptr_t)receiveEnv->env_ipc_dstva < UTOP)
f0104c82:	8b 55 dc             	mov    -0x24(%ebp),%edx
f0104c85:	8b 4a 6c             	mov    0x6c(%edx),%ecx
f0104c88:	81 f9 ff ff bf ee    	cmp    $0xeebfffff,%ecx
f0104c8e:	76 4d                	jbe    f0104cdd <syscall+0x542>
	receiveEnv->env_ipc_recving = 0;
f0104c90:	8b 45 dc             	mov    -0x24(%ebp),%eax
f0104c93:	c6 40 68 00          	movb   $0x0,0x68(%eax)
	receiveEnv->env_ipc_from = currentEnv->env_id;
f0104c97:	8b 55 e0             	mov    -0x20(%ebp),%edx
f0104c9a:	8b 52 48             	mov    0x48(%edx),%edx
f0104c9d:	89 50 74             	mov    %edx,0x74(%eax)
	receiveEnv->env_ipc_value = value;
f0104ca0:	8b 4d 10             	mov    0x10(%ebp),%ecx
f0104ca3:	89 48 70             	mov    %ecx,0x70(%eax)
	receiveEnv->env_ipc_perm = perm;
f0104ca6:	8b 4d 18             	mov    0x18(%ebp),%ecx
f0104ca9:	89 48 78             	mov    %ecx,0x78(%eax)
	receiveEnv->env_status = ENV_RUNNABLE;
f0104cac:	c7 40 54 02 00 00 00 	movl   $0x2,0x54(%eax)
    receiveEnv->env_tf.tf_regs.reg_eax = 0;
f0104cb3:	c7 40 1c 00 00 00 00 	movl   $0x0,0x1c(%eax)
	return 0;
f0104cba:	bb 00 00 00 00       	mov    $0x0,%ebx
f0104cbf:	e9 27 fb ff ff       	jmp    f01047eb <syscall+0x50>
	assert(currentEnv);
f0104cc4:	68 1e 7c 10 f0       	push   $0xf0107c1e
f0104cc9:	68 47 74 10 f0       	push   $0xf0107447
f0104cce:	68 4f 01 00 00       	push   $0x14f
f0104cd3:	68 29 7c 10 f0       	push   $0xf0107c29
f0104cd8:	e8 63 b3 ff ff       	call   f0100040 <_panic>
			if((error = page_insert(receiveEnv->env_pgdir,pageinfo,receiveEnv->env_ipc_dstva,perm))<0)
f0104cdd:	ff 75 18             	pushl  0x18(%ebp)
f0104ce0:	51                   	push   %ecx
f0104ce1:	50                   	push   %eax
f0104ce2:	ff 72 60             	pushl  0x60(%edx)
f0104ce5:	e8 6f c4 ff ff       	call   f0101159 <page_insert>
f0104cea:	89 c3                	mov    %eax,%ebx
f0104cec:	83 c4 10             	add    $0x10,%esp
f0104cef:	85 c0                	test   %eax,%eax
f0104cf1:	79 9d                	jns    f0104c90 <syscall+0x4f5>
f0104cf3:	e9 f3 fa ff ff       	jmp    f01047eb <syscall+0x50>
			return -E_INVAL;
f0104cf8:	bb fd ff ff ff       	mov    $0xfffffffd,%ebx
f0104cfd:	e9 e9 fa ff ff       	jmp    f01047eb <syscall+0x50>
		return -E_IPC_NOT_RECV;
f0104d02:	bb f9 ff ff ff       	mov    $0xfffffff9,%ebx
		return sys_ipc_try_send((envid_t)a1,(uint32_t)a2,(void*)a3,(unsigned int)a4);
f0104d07:	e9 df fa ff ff       	jmp    f01047eb <syscall+0x50>
	if((uintptr_t)dstva < UTOP && (uintptr_t)dstva & (PGSIZE - 1))return -E_INVAL;
f0104d0c:	81 7d 0c ff ff bf ee 	cmpl   $0xeebfffff,0xc(%ebp)
f0104d13:	77 12                	ja     f0104d27 <syscall+0x58c>
		return sys_ipc_recv((void *)a1);
f0104d15:	bb fd ff ff ff       	mov    $0xfffffffd,%ebx
	if((uintptr_t)dstva < UTOP && (uintptr_t)dstva & (PGSIZE - 1))return -E_INVAL;
f0104d1a:	f7 45 0c ff 0f 00 00 	testl  $0xfff,0xc(%ebp)
f0104d21:	0f 85 c4 fa ff ff    	jne    f01047eb <syscall+0x50>
	envid2env(0, &currentEnv, 0);
f0104d27:	83 ec 04             	sub    $0x4,%esp
f0104d2a:	6a 00                	push   $0x0
f0104d2c:	8d 45 e4             	lea    -0x1c(%ebp),%eax
f0104d2f:	50                   	push   %eax
f0104d30:	6a 00                	push   $0x0
f0104d32:	e8 4c e2 ff ff       	call   f0102f83 <envid2env>
	assert(currentEnv);
f0104d37:	8b 45 e4             	mov    -0x1c(%ebp),%eax
f0104d3a:	83 c4 10             	add    $0x10,%esp
f0104d3d:	85 c0                	test   %eax,%eax
f0104d3f:	74 16                	je     f0104d57 <syscall+0x5bc>
	currentEnv->env_status = ENV_NOT_RUNNABLE;
f0104d41:	c7 40 54 04 00 00 00 	movl   $0x4,0x54(%eax)
	currentEnv->env_ipc_recving = 1;
f0104d48:	c6 40 68 01          	movb   $0x1,0x68(%eax)
	currentEnv->env_ipc_dstva = dstva;
f0104d4c:	8b 7d 0c             	mov    0xc(%ebp),%edi
f0104d4f:	89 78 6c             	mov    %edi,0x6c(%eax)
	sched_yield();
f0104d52:	e8 99 f9 ff ff       	call   f01046f0 <sched_yield>
	assert(currentEnv);
f0104d57:	68 1e 7c 10 f0       	push   $0xf0107c1e
f0104d5c:	68 47 74 10 f0       	push   $0xf0107447
f0104d61:	68 8f 01 00 00       	push   $0x18f
f0104d66:	68 29 7c 10 f0       	push   $0xf0107c29
f0104d6b:	e8 d0 b2 ff ff       	call   f0100040 <_panic>
	if ((ret = envid2env(envid, &e, 1)) < 0) {
f0104d70:	83 ec 04             	sub    $0x4,%esp
f0104d73:	6a 01                	push   $0x1
f0104d75:	8d 45 e4             	lea    -0x1c(%ebp),%eax
f0104d78:	50                   	push   %eax
f0104d79:	ff 75 0c             	pushl  0xc(%ebp)
f0104d7c:	e8 02 e2 ff ff       	call   f0102f83 <envid2env>
f0104d81:	89 c3                	mov    %eax,%ebx
f0104d83:	83 c4 10             	add    $0x10,%esp
f0104d86:	85 c0                	test   %eax,%eax
f0104d88:	0f 88 5d fa ff ff    	js     f01047eb <syscall+0x50>
	if ((ret = user_mem_check(e, tf, sizeof(struct Trapframe), PTE_U)) < 0) {
f0104d8e:	6a 04                	push   $0x4
f0104d90:	6a 44                	push   $0x44
f0104d92:	ff 75 10             	pushl  0x10(%ebp)
f0104d95:	ff 75 e4             	pushl  -0x1c(%ebp)
f0104d98:	e8 a7 e0 ff ff       	call   f0102e44 <user_mem_check>
f0104d9d:	89 c3                	mov    %eax,%ebx
f0104d9f:	83 c4 10             	add    $0x10,%esp
f0104da2:	85 c0                	test   %eax,%eax
f0104da4:	0f 88 41 fa ff ff    	js     f01047eb <syscall+0x50>
	memmove(&e->env_tf, tf, sizeof(struct Trapframe));
f0104daa:	83 ec 04             	sub    $0x4,%esp
f0104dad:	6a 44                	push   $0x44
f0104daf:	ff 75 10             	pushl  0x10(%ebp)
f0104db2:	ff 75 e4             	pushl  -0x1c(%ebp)
f0104db5:	e8 7c 0b 00 00       	call   f0105936 <memmove>
	e->env_tf.tf_ds = GD_UD | 3;
f0104dba:	8b 45 e4             	mov    -0x1c(%ebp),%eax
f0104dbd:	66 c7 40 24 23 00    	movw   $0x23,0x24(%eax)
	e->env_tf.tf_es = GD_UD | 3;
f0104dc3:	66 c7 40 20 23 00    	movw   $0x23,0x20(%eax)
	e->env_tf.tf_ss = GD_UD | 3;
f0104dc9:	66 c7 40 40 23 00    	movw   $0x23,0x40(%eax)
	e->env_tf.tf_cs = GD_UT | 3;
f0104dcf:	66 c7 40 34 1b 00    	movw   $0x1b,0x34(%eax)
	e->env_tf.tf_eflags &= ~FL_IOPL_MASK; //普通进程不能有IO权限
f0104dd5:	8b 50 38             	mov    0x38(%eax),%edx
f0104dd8:	80 e6 cf             	and    $0xcf,%dh
f0104ddb:	80 ce 02             	or     $0x2,%dh
f0104dde:	89 50 38             	mov    %edx,0x38(%eax)
	return 0;
f0104de1:	83 c4 10             	add    $0x10,%esp
f0104de4:	bb 00 00 00 00       	mov    $0x0,%ebx
		return sys_env_set_trapframe((envid_t)a1,(struct Trapframe*)a2);
f0104de9:	e9 fd f9 ff ff       	jmp    f01047eb <syscall+0x50>
		return sys_ipc_recv((void *)a1);
f0104dee:	bb fd ff ff ff       	mov    $0xfffffffd,%ebx
f0104df3:	e9 f3 f9 ff ff       	jmp    f01047eb <syscall+0x50>

f0104df8 <stab_binsearch>:
//	will exit setting left = 118, right = 554.
//
static void
stab_binsearch(const struct Stab *stabs, int *region_left, int *region_right,
	       int type, uintptr_t addr)
{
f0104df8:	55                   	push   %ebp
f0104df9:	89 e5                	mov    %esp,%ebp
f0104dfb:	57                   	push   %edi
f0104dfc:	56                   	push   %esi
f0104dfd:	53                   	push   %ebx
f0104dfe:	83 ec 14             	sub    $0x14,%esp
f0104e01:	89 45 ec             	mov    %eax,-0x14(%ebp)
f0104e04:	89 55 e4             	mov    %edx,-0x1c(%ebp)
f0104e07:	89 4d e0             	mov    %ecx,-0x20(%ebp)
f0104e0a:	8b 75 08             	mov    0x8(%ebp),%esi
	int l = *region_left, r = *region_right, any_matches = 0;
f0104e0d:	8b 1a                	mov    (%edx),%ebx
f0104e0f:	8b 01                	mov    (%ecx),%eax
f0104e11:	89 45 f0             	mov    %eax,-0x10(%ebp)
f0104e14:	c7 45 e8 00 00 00 00 	movl   $0x0,-0x18(%ebp)

	while (l <= r) {
f0104e1b:	eb 23                	jmp    f0104e40 <stab_binsearch+0x48>

		// search for earliest stab with right type
		while (m >= l && stabs[m].n_type != type)
			m--;
		if (m < l) {	// no match in [l, m]
			l = true_m + 1;
f0104e1d:	8d 5f 01             	lea    0x1(%edi),%ebx
			continue;
f0104e20:	eb 1e                	jmp    f0104e40 <stab_binsearch+0x48>
		}

		// actual binary search
		any_matches = 1;
		if (stabs[m].n_value < addr) {
f0104e22:	8d 14 40             	lea    (%eax,%eax,2),%edx
f0104e25:	8b 4d ec             	mov    -0x14(%ebp),%ecx
f0104e28:	8b 54 91 08          	mov    0x8(%ecx,%edx,4),%edx
f0104e2c:	3b 55 0c             	cmp    0xc(%ebp),%edx
f0104e2f:	73 46                	jae    f0104e77 <stab_binsearch+0x7f>
			*region_left = m;
f0104e31:	8b 5d e4             	mov    -0x1c(%ebp),%ebx
f0104e34:	89 03                	mov    %eax,(%ebx)
			l = true_m + 1;
f0104e36:	8d 5f 01             	lea    0x1(%edi),%ebx
		any_matches = 1;
f0104e39:	c7 45 e8 01 00 00 00 	movl   $0x1,-0x18(%ebp)
	while (l <= r) {
f0104e40:	3b 5d f0             	cmp    -0x10(%ebp),%ebx
f0104e43:	7f 5f                	jg     f0104ea4 <stab_binsearch+0xac>
		int true_m = (l + r) / 2, m = true_m;
f0104e45:	8b 45 f0             	mov    -0x10(%ebp),%eax
f0104e48:	8d 14 03             	lea    (%ebx,%eax,1),%edx
f0104e4b:	89 d0                	mov    %edx,%eax
f0104e4d:	c1 e8 1f             	shr    $0x1f,%eax
f0104e50:	01 d0                	add    %edx,%eax
f0104e52:	89 c7                	mov    %eax,%edi
f0104e54:	d1 ff                	sar    %edi
f0104e56:	83 e0 fe             	and    $0xfffffffe,%eax
f0104e59:	01 f8                	add    %edi,%eax
f0104e5b:	8b 4d ec             	mov    -0x14(%ebp),%ecx
f0104e5e:	8d 54 81 04          	lea    0x4(%ecx,%eax,4),%edx
f0104e62:	89 f8                	mov    %edi,%eax
		while (m >= l && stabs[m].n_type != type)
f0104e64:	39 c3                	cmp    %eax,%ebx
f0104e66:	7f b5                	jg     f0104e1d <stab_binsearch+0x25>
f0104e68:	0f b6 0a             	movzbl (%edx),%ecx
f0104e6b:	83 ea 0c             	sub    $0xc,%edx
f0104e6e:	39 f1                	cmp    %esi,%ecx
f0104e70:	74 b0                	je     f0104e22 <stab_binsearch+0x2a>
			m--;
f0104e72:	83 e8 01             	sub    $0x1,%eax
f0104e75:	eb ed                	jmp    f0104e64 <stab_binsearch+0x6c>
		} else if (stabs[m].n_value > addr) {
f0104e77:	3b 55 0c             	cmp    0xc(%ebp),%edx
f0104e7a:	76 14                	jbe    f0104e90 <stab_binsearch+0x98>
			*region_right = m - 1;
f0104e7c:	83 e8 01             	sub    $0x1,%eax
f0104e7f:	89 45 f0             	mov    %eax,-0x10(%ebp)
f0104e82:	8b 7d e0             	mov    -0x20(%ebp),%edi
f0104e85:	89 07                	mov    %eax,(%edi)
		any_matches = 1;
f0104e87:	c7 45 e8 01 00 00 00 	movl   $0x1,-0x18(%ebp)
f0104e8e:	eb b0                	jmp    f0104e40 <stab_binsearch+0x48>
			r = m - 1;
		} else {
			// exact match for 'addr', but continue loop to find
			// *region_right
			*region_left = m;
f0104e90:	8b 7d e4             	mov    -0x1c(%ebp),%edi
f0104e93:	89 07                	mov    %eax,(%edi)
			l = m;
			addr++;
f0104e95:	83 45 0c 01          	addl   $0x1,0xc(%ebp)
f0104e99:	89 c3                	mov    %eax,%ebx
		any_matches = 1;
f0104e9b:	c7 45 e8 01 00 00 00 	movl   $0x1,-0x18(%ebp)
f0104ea2:	eb 9c                	jmp    f0104e40 <stab_binsearch+0x48>
		}
	}

	if (!any_matches)
f0104ea4:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
f0104ea8:	75 15                	jne    f0104ebf <stab_binsearch+0xc7>
		*region_right = *region_left - 1;
f0104eaa:	8b 45 e4             	mov    -0x1c(%ebp),%eax
f0104ead:	8b 00                	mov    (%eax),%eax
f0104eaf:	83 e8 01             	sub    $0x1,%eax
f0104eb2:	8b 7d e0             	mov    -0x20(%ebp),%edi
f0104eb5:	89 07                	mov    %eax,(%edi)
		     l > *region_left && stabs[l].n_type != type;
		     l--)
			/* do nothing */;
		*region_left = l;
	}
}
f0104eb7:	83 c4 14             	add    $0x14,%esp
f0104eba:	5b                   	pop    %ebx
f0104ebb:	5e                   	pop    %esi
f0104ebc:	5f                   	pop    %edi
f0104ebd:	5d                   	pop    %ebp
f0104ebe:	c3                   	ret    
		for (l = *region_right;
f0104ebf:	8b 45 e0             	mov    -0x20(%ebp),%eax
f0104ec2:	8b 00                	mov    (%eax),%eax
		     l > *region_left && stabs[l].n_type != type;
f0104ec4:	8b 7d e4             	mov    -0x1c(%ebp),%edi
f0104ec7:	8b 0f                	mov    (%edi),%ecx
f0104ec9:	8d 14 40             	lea    (%eax,%eax,2),%edx
f0104ecc:	8b 7d ec             	mov    -0x14(%ebp),%edi
f0104ecf:	8d 54 97 04          	lea    0x4(%edi,%edx,4),%edx
		for (l = *region_right;
f0104ed3:	eb 03                	jmp    f0104ed8 <stab_binsearch+0xe0>
		     l--)
f0104ed5:	83 e8 01             	sub    $0x1,%eax
		for (l = *region_right;
f0104ed8:	39 c1                	cmp    %eax,%ecx
f0104eda:	7d 0a                	jge    f0104ee6 <stab_binsearch+0xee>
		     l > *region_left && stabs[l].n_type != type;
f0104edc:	0f b6 1a             	movzbl (%edx),%ebx
f0104edf:	83 ea 0c             	sub    $0xc,%edx
f0104ee2:	39 f3                	cmp    %esi,%ebx
f0104ee4:	75 ef                	jne    f0104ed5 <stab_binsearch+0xdd>
		*region_left = l;
f0104ee6:	8b 7d e4             	mov    -0x1c(%ebp),%edi
f0104ee9:	89 07                	mov    %eax,(%edi)
}
f0104eeb:	eb ca                	jmp    f0104eb7 <stab_binsearch+0xbf>

f0104eed <debuginfo_eip>:
//	negative if not.  But even if it returns negative it has stored some
//	information into '*info'.
//
int
debuginfo_eip(uintptr_t addr, struct Eipdebuginfo *info)
{
f0104eed:	f3 0f 1e fb          	endbr32 
f0104ef1:	55                   	push   %ebp
f0104ef2:	89 e5                	mov    %esp,%ebp
f0104ef4:	57                   	push   %edi
f0104ef5:	56                   	push   %esi
f0104ef6:	53                   	push   %ebx
f0104ef7:	83 ec 2c             	sub    $0x2c,%esp
f0104efa:	8b 7d 08             	mov    0x8(%ebp),%edi
f0104efd:	8b 75 0c             	mov    0xc(%ebp),%esi
	const struct Stab *stabs, *stab_end;
	const char *stabstr, *stabstr_end;
	int lfile, rfile, lfun, rfun, lline, rline;

	// Initialize *info
	info->eip_file = "<unknown>";
f0104f00:	c7 06 70 7c 10 f0    	movl   $0xf0107c70,(%esi)
	info->eip_line = 0;
f0104f06:	c7 46 04 00 00 00 00 	movl   $0x0,0x4(%esi)
	info->eip_fn_name = "<unknown>";
f0104f0d:	c7 46 08 70 7c 10 f0 	movl   $0xf0107c70,0x8(%esi)
	info->eip_fn_namelen = 9;
f0104f14:	c7 46 0c 09 00 00 00 	movl   $0x9,0xc(%esi)
	info->eip_fn_addr = addr;
f0104f1b:	89 7e 10             	mov    %edi,0x10(%esi)
	info->eip_fn_narg = 0;
f0104f1e:	c7 46 14 00 00 00 00 	movl   $0x0,0x14(%esi)

	// Find the relevant set of stabs
	if (addr >= ULIM) {
f0104f25:	81 ff ff ff 7f ef    	cmp    $0xef7fffff,%edi
f0104f2b:	0f 87 e0 00 00 00    	ja     f0105011 <debuginfo_eip+0x124>

		// Make sure this memory is valid.
		// Return -1 if it is not.  Hint: Call user_mem_check.
		// LAB 3: Your code here.

		stabs = usd->stabs;
f0104f31:	a1 00 00 20 00       	mov    0x200000,%eax
f0104f36:	89 45 d4             	mov    %eax,-0x2c(%ebp)
		stab_end = usd->stab_end;
f0104f39:	a1 04 00 20 00       	mov    0x200004,%eax
		stabstr = usd->stabstr;
f0104f3e:	8b 0d 08 00 20 00    	mov    0x200008,%ecx
f0104f44:	89 4d cc             	mov    %ecx,-0x34(%ebp)
		stabstr_end = usd->stabstr_end;
f0104f47:	8b 0d 0c 00 20 00    	mov    0x20000c,%ecx
f0104f4d:	89 4d d0             	mov    %ecx,-0x30(%ebp)
		// Make sure the STABS and string table memory is valid.
		// LAB 3: Your code here.
	}

	// String table validity checks
	if (stabstr_end <= stabstr || stabstr_end[-1] != 0)
f0104f50:	8b 4d d0             	mov    -0x30(%ebp),%ecx
f0104f53:	39 4d cc             	cmp    %ecx,-0x34(%ebp)
f0104f56:	0f 83 4d 01 00 00    	jae    f01050a9 <debuginfo_eip+0x1bc>
f0104f5c:	80 79 ff 00          	cmpb   $0x0,-0x1(%ecx)
f0104f60:	0f 85 4a 01 00 00    	jne    f01050b0 <debuginfo_eip+0x1c3>
	// 'eip'.  First, we find the basic source file containing 'eip'.
	// Then, we look in that source file for the function.  Then we look
	// for the line number.

	// Search the entire set of stabs for the source file (type N_SO).
	lfile = 0;
f0104f66:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
	rfile = (stab_end - stabs) - 1;
f0104f6d:	8b 5d d4             	mov    -0x2c(%ebp),%ebx
f0104f70:	29 d8                	sub    %ebx,%eax
f0104f72:	c1 f8 02             	sar    $0x2,%eax
f0104f75:	69 c0 ab aa aa aa    	imul   $0xaaaaaaab,%eax,%eax
f0104f7b:	83 e8 01             	sub    $0x1,%eax
f0104f7e:	89 45 e0             	mov    %eax,-0x20(%ebp)
	stab_binsearch(stabs, &lfile, &rfile, N_SO, addr);
f0104f81:	57                   	push   %edi
f0104f82:	6a 64                	push   $0x64
f0104f84:	8d 45 e0             	lea    -0x20(%ebp),%eax
f0104f87:	89 c1                	mov    %eax,%ecx
f0104f89:	8d 55 e4             	lea    -0x1c(%ebp),%edx
f0104f8c:	89 d8                	mov    %ebx,%eax
f0104f8e:	e8 65 fe ff ff       	call   f0104df8 <stab_binsearch>
	if (lfile == 0)
f0104f93:	8b 45 e4             	mov    -0x1c(%ebp),%eax
f0104f96:	83 c4 08             	add    $0x8,%esp
f0104f99:	85 c0                	test   %eax,%eax
f0104f9b:	0f 84 16 01 00 00    	je     f01050b7 <debuginfo_eip+0x1ca>
		return -1;

	// Search within that file's stabs for the function definition
	// (N_FUN).
	lfun = lfile;
f0104fa1:	89 45 dc             	mov    %eax,-0x24(%ebp)
	rfun = rfile;
f0104fa4:	8b 45 e0             	mov    -0x20(%ebp),%eax
f0104fa7:	89 45 d8             	mov    %eax,-0x28(%ebp)
	stab_binsearch(stabs, &lfun, &rfun, N_FUN, addr);
f0104faa:	57                   	push   %edi
f0104fab:	6a 24                	push   $0x24
f0104fad:	8d 45 d8             	lea    -0x28(%ebp),%eax
f0104fb0:	89 c1                	mov    %eax,%ecx
f0104fb2:	8d 55 dc             	lea    -0x24(%ebp),%edx
f0104fb5:	89 5d d4             	mov    %ebx,-0x2c(%ebp)
f0104fb8:	89 d8                	mov    %ebx,%eax
f0104fba:	e8 39 fe ff ff       	call   f0104df8 <stab_binsearch>

	if (lfun <= rfun) {
f0104fbf:	8b 5d dc             	mov    -0x24(%ebp),%ebx
f0104fc2:	83 c4 08             	add    $0x8,%esp
f0104fc5:	3b 5d d8             	cmp    -0x28(%ebp),%ebx
f0104fc8:	7f 66                	jg     f0105030 <debuginfo_eip+0x143>
		// stabs[lfun] points to the function name
		// in the string table, but check bounds just in case.
		if (stabs[lfun].n_strx < stabstr_end - stabstr)
f0104fca:	8d 04 5b             	lea    (%ebx,%ebx,2),%eax
f0104fcd:	8b 7d d4             	mov    -0x2c(%ebp),%edi
f0104fd0:	8d 14 87             	lea    (%edi,%eax,4),%edx
f0104fd3:	8b 02                	mov    (%edx),%eax
f0104fd5:	8b 4d d0             	mov    -0x30(%ebp),%ecx
f0104fd8:	8b 7d cc             	mov    -0x34(%ebp),%edi
f0104fdb:	29 f9                	sub    %edi,%ecx
f0104fdd:	39 c8                	cmp    %ecx,%eax
f0104fdf:	73 05                	jae    f0104fe6 <debuginfo_eip+0xf9>
			info->eip_fn_name = stabstr + stabs[lfun].n_strx;
f0104fe1:	01 f8                	add    %edi,%eax
f0104fe3:	89 46 08             	mov    %eax,0x8(%esi)
		info->eip_fn_addr = stabs[lfun].n_value;
f0104fe6:	8b 42 08             	mov    0x8(%edx),%eax
f0104fe9:	89 46 10             	mov    %eax,0x10(%esi)
		info->eip_fn_addr = addr;
		lline = lfile;
		rline = rfile;
	}
	// Ignore stuff after the colon.
	info->eip_fn_namelen = strfind(info->eip_fn_name, ':') - info->eip_fn_name;
f0104fec:	83 ec 08             	sub    $0x8,%esp
f0104fef:	6a 3a                	push   $0x3a
f0104ff1:	ff 76 08             	pushl  0x8(%esi)
f0104ff4:	e8 d1 08 00 00       	call   f01058ca <strfind>
f0104ff9:	2b 46 08             	sub    0x8(%esi),%eax
f0104ffc:	89 46 0c             	mov    %eax,0xc(%esi)
	// Search backwards from the line number for the relevant filename
	// stab.
	// We can't just use the "lfile" stab because inlined functions
	// can interpolate code from a different file!
	// Such included source files use the N_SOL stab type.
	while (lline >= lfile
f0104fff:	8b 7d e4             	mov    -0x1c(%ebp),%edi
f0105002:	8d 04 5b             	lea    (%ebx,%ebx,2),%eax
f0105005:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
f0105008:	8d 44 81 04          	lea    0x4(%ecx,%eax,4),%eax
f010500c:	83 c4 10             	add    $0x10,%esp
f010500f:	eb 2d                	jmp    f010503e <debuginfo_eip+0x151>
		stabstr_end = __STABSTR_END__;
f0105011:	c7 45 d0 71 82 11 f0 	movl   $0xf0118271,-0x30(%ebp)
		stabstr = __STABSTR_BEGIN__;
f0105018:	c7 45 cc 2d 4a 11 f0 	movl   $0xf0114a2d,-0x34(%ebp)
		stab_end = __STAB_END__;
f010501f:	b8 2c 4a 11 f0       	mov    $0xf0114a2c,%eax
		stabs = __STAB_BEGIN__;
f0105024:	c7 45 d4 10 82 10 f0 	movl   $0xf0108210,-0x2c(%ebp)
f010502b:	e9 20 ff ff ff       	jmp    f0104f50 <debuginfo_eip+0x63>
		info->eip_fn_addr = addr;
f0105030:	89 7e 10             	mov    %edi,0x10(%esi)
		lline = lfile;
f0105033:	8b 5d e4             	mov    -0x1c(%ebp),%ebx
f0105036:	eb b4                	jmp    f0104fec <debuginfo_eip+0xff>
	       && stabs[lline].n_type != N_SOL
	       && (stabs[lline].n_type != N_SO || !stabs[lline].n_value))
		lline--;
f0105038:	83 eb 01             	sub    $0x1,%ebx
f010503b:	83 e8 0c             	sub    $0xc,%eax
	while (lline >= lfile
f010503e:	39 df                	cmp    %ebx,%edi
f0105040:	7f 2e                	jg     f0105070 <debuginfo_eip+0x183>
	       && stabs[lline].n_type != N_SOL
f0105042:	0f b6 10             	movzbl (%eax),%edx
f0105045:	80 fa 84             	cmp    $0x84,%dl
f0105048:	74 0b                	je     f0105055 <debuginfo_eip+0x168>
	       && (stabs[lline].n_type != N_SO || !stabs[lline].n_value))
f010504a:	80 fa 64             	cmp    $0x64,%dl
f010504d:	75 e9                	jne    f0105038 <debuginfo_eip+0x14b>
f010504f:	83 78 04 00          	cmpl   $0x0,0x4(%eax)
f0105053:	74 e3                	je     f0105038 <debuginfo_eip+0x14b>
	if (lline >= lfile && stabs[lline].n_strx < stabstr_end - stabstr)
f0105055:	8d 04 5b             	lea    (%ebx,%ebx,2),%eax
f0105058:	8b 7d d4             	mov    -0x2c(%ebp),%edi
f010505b:	8b 14 87             	mov    (%edi,%eax,4),%edx
f010505e:	8b 45 d0             	mov    -0x30(%ebp),%eax
f0105061:	8b 7d cc             	mov    -0x34(%ebp),%edi
f0105064:	29 f8                	sub    %edi,%eax
f0105066:	39 c2                	cmp    %eax,%edx
f0105068:	73 06                	jae    f0105070 <debuginfo_eip+0x183>
		info->eip_file = stabstr + stabs[lline].n_strx;
f010506a:	89 f8                	mov    %edi,%eax
f010506c:	01 d0                	add    %edx,%eax
f010506e:	89 06                	mov    %eax,(%esi)


	// Set eip_fn_narg to the number of arguments taken by the function,
	// or 0 if there was no containing function.
	if (lfun < rfun)
f0105070:	8b 45 dc             	mov    -0x24(%ebp),%eax
f0105073:	8b 4d d8             	mov    -0x28(%ebp),%ecx
		for (lline = lfun + 1;
		     lline < rfun && stabs[lline].n_type == N_PSYM;
		     lline++)
			info->eip_fn_narg++;

	return 0;
f0105076:	ba 00 00 00 00       	mov    $0x0,%edx
	if (lfun < rfun)
f010507b:	39 c8                	cmp    %ecx,%eax
f010507d:	7d 44                	jge    f01050c3 <debuginfo_eip+0x1d6>
		for (lline = lfun + 1;
f010507f:	8d 50 01             	lea    0x1(%eax),%edx
f0105082:	8d 04 40             	lea    (%eax,%eax,2),%eax
f0105085:	8b 7d d4             	mov    -0x2c(%ebp),%edi
f0105088:	8d 44 87 10          	lea    0x10(%edi,%eax,4),%eax
f010508c:	eb 07                	jmp    f0105095 <debuginfo_eip+0x1a8>
			info->eip_fn_narg++;
f010508e:	83 46 14 01          	addl   $0x1,0x14(%esi)
		     lline++)
f0105092:	83 c2 01             	add    $0x1,%edx
		for (lline = lfun + 1;
f0105095:	39 d1                	cmp    %edx,%ecx
f0105097:	74 25                	je     f01050be <debuginfo_eip+0x1d1>
f0105099:	83 c0 0c             	add    $0xc,%eax
		     lline < rfun && stabs[lline].n_type == N_PSYM;
f010509c:	80 78 f4 a0          	cmpb   $0xa0,-0xc(%eax)
f01050a0:	74 ec                	je     f010508e <debuginfo_eip+0x1a1>
	return 0;
f01050a2:	ba 00 00 00 00       	mov    $0x0,%edx
f01050a7:	eb 1a                	jmp    f01050c3 <debuginfo_eip+0x1d6>
		return -1;
f01050a9:	ba ff ff ff ff       	mov    $0xffffffff,%edx
f01050ae:	eb 13                	jmp    f01050c3 <debuginfo_eip+0x1d6>
f01050b0:	ba ff ff ff ff       	mov    $0xffffffff,%edx
f01050b5:	eb 0c                	jmp    f01050c3 <debuginfo_eip+0x1d6>
		return -1;
f01050b7:	ba ff ff ff ff       	mov    $0xffffffff,%edx
f01050bc:	eb 05                	jmp    f01050c3 <debuginfo_eip+0x1d6>
	return 0;
f01050be:	ba 00 00 00 00       	mov    $0x0,%edx
}
f01050c3:	89 d0                	mov    %edx,%eax
f01050c5:	8d 65 f4             	lea    -0xc(%ebp),%esp
f01050c8:	5b                   	pop    %ebx
f01050c9:	5e                   	pop    %esi
f01050ca:	5f                   	pop    %edi
f01050cb:	5d                   	pop    %ebp
f01050cc:	c3                   	ret    

f01050cd <printnum>:
 * using specified putch function and associated pointer putdat.
 */
static void
printnum(void (*putch)(int, void*), void *putdat,
	 unsigned long long num, unsigned base, int width, int padc)
{
f01050cd:	55                   	push   %ebp
f01050ce:	89 e5                	mov    %esp,%ebp
f01050d0:	57                   	push   %edi
f01050d1:	56                   	push   %esi
f01050d2:	53                   	push   %ebx
f01050d3:	83 ec 1c             	sub    $0x1c,%esp
f01050d6:	89 c7                	mov    %eax,%edi
f01050d8:	89 d6                	mov    %edx,%esi
f01050da:	8b 45 08             	mov    0x8(%ebp),%eax
f01050dd:	8b 55 0c             	mov    0xc(%ebp),%edx
f01050e0:	89 d1                	mov    %edx,%ecx
f01050e2:	89 c2                	mov    %eax,%edx
f01050e4:	89 45 d8             	mov    %eax,-0x28(%ebp)
f01050e7:	89 4d dc             	mov    %ecx,-0x24(%ebp)
f01050ea:	8b 45 10             	mov    0x10(%ebp),%eax
f01050ed:	8b 5d 14             	mov    0x14(%ebp),%ebx
	// first recursively print all preceding (more significant) digits
	if (num >= base) {
f01050f0:	89 45 e0             	mov    %eax,-0x20(%ebp)
f01050f3:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
f01050fa:	39 c2                	cmp    %eax,%edx
f01050fc:	1b 4d e4             	sbb    -0x1c(%ebp),%ecx
f01050ff:	72 3e                	jb     f010513f <printnum+0x72>
		printnum(putch, putdat, num / base, base, width - 1, padc);
f0105101:	83 ec 0c             	sub    $0xc,%esp
f0105104:	ff 75 18             	pushl  0x18(%ebp)
f0105107:	83 eb 01             	sub    $0x1,%ebx
f010510a:	53                   	push   %ebx
f010510b:	50                   	push   %eax
f010510c:	83 ec 08             	sub    $0x8,%esp
f010510f:	ff 75 e4             	pushl  -0x1c(%ebp)
f0105112:	ff 75 e0             	pushl  -0x20(%ebp)
f0105115:	ff 75 dc             	pushl  -0x24(%ebp)
f0105118:	ff 75 d8             	pushl  -0x28(%ebp)
f010511b:	e8 00 12 00 00       	call   f0106320 <__udivdi3>
f0105120:	83 c4 18             	add    $0x18,%esp
f0105123:	52                   	push   %edx
f0105124:	50                   	push   %eax
f0105125:	89 f2                	mov    %esi,%edx
f0105127:	89 f8                	mov    %edi,%eax
f0105129:	e8 9f ff ff ff       	call   f01050cd <printnum>
f010512e:	83 c4 20             	add    $0x20,%esp
f0105131:	eb 13                	jmp    f0105146 <printnum+0x79>
	} else {
		// print any needed pad characters before first digit
		while (--width > 0)
			putch(padc, putdat);
f0105133:	83 ec 08             	sub    $0x8,%esp
f0105136:	56                   	push   %esi
f0105137:	ff 75 18             	pushl  0x18(%ebp)
f010513a:	ff d7                	call   *%edi
f010513c:	83 c4 10             	add    $0x10,%esp
		while (--width > 0)
f010513f:	83 eb 01             	sub    $0x1,%ebx
f0105142:	85 db                	test   %ebx,%ebx
f0105144:	7f ed                	jg     f0105133 <printnum+0x66>
	}

	// then print this (the least significant) digit
	putch("0123456789abcdef"[num % base], putdat);
f0105146:	83 ec 08             	sub    $0x8,%esp
f0105149:	56                   	push   %esi
f010514a:	83 ec 04             	sub    $0x4,%esp
f010514d:	ff 75 e4             	pushl  -0x1c(%ebp)
f0105150:	ff 75 e0             	pushl  -0x20(%ebp)
f0105153:	ff 75 dc             	pushl  -0x24(%ebp)
f0105156:	ff 75 d8             	pushl  -0x28(%ebp)
f0105159:	e8 d2 12 00 00       	call   f0106430 <__umoddi3>
f010515e:	83 c4 14             	add    $0x14,%esp
f0105161:	0f be 80 7a 7c 10 f0 	movsbl -0xfef8386(%eax),%eax
f0105168:	50                   	push   %eax
f0105169:	ff d7                	call   *%edi
}
f010516b:	83 c4 10             	add    $0x10,%esp
f010516e:	8d 65 f4             	lea    -0xc(%ebp),%esp
f0105171:	5b                   	pop    %ebx
f0105172:	5e                   	pop    %esi
f0105173:	5f                   	pop    %edi
f0105174:	5d                   	pop    %ebp
f0105175:	c3                   	ret    

f0105176 <sprintputch>:
	int cnt;
};

static void
sprintputch(int ch, struct sprintbuf *b)
{
f0105176:	f3 0f 1e fb          	endbr32 
f010517a:	55                   	push   %ebp
f010517b:	89 e5                	mov    %esp,%ebp
f010517d:	8b 45 0c             	mov    0xc(%ebp),%eax
	b->cnt++;
f0105180:	83 40 08 01          	addl   $0x1,0x8(%eax)
	if (b->buf < b->ebuf)
f0105184:	8b 10                	mov    (%eax),%edx
f0105186:	3b 50 04             	cmp    0x4(%eax),%edx
f0105189:	73 0a                	jae    f0105195 <sprintputch+0x1f>
		*b->buf++ = ch;
f010518b:	8d 4a 01             	lea    0x1(%edx),%ecx
f010518e:	89 08                	mov    %ecx,(%eax)
f0105190:	8b 45 08             	mov    0x8(%ebp),%eax
f0105193:	88 02                	mov    %al,(%edx)
}
f0105195:	5d                   	pop    %ebp
f0105196:	c3                   	ret    

f0105197 <printfmt>:
{
f0105197:	f3 0f 1e fb          	endbr32 
f010519b:	55                   	push   %ebp
f010519c:	89 e5                	mov    %esp,%ebp
f010519e:	83 ec 08             	sub    $0x8,%esp
	va_start(ap, fmt);
f01051a1:	8d 45 14             	lea    0x14(%ebp),%eax
	vprintfmt(putch, putdat, fmt, ap);
f01051a4:	50                   	push   %eax
f01051a5:	ff 75 10             	pushl  0x10(%ebp)
f01051a8:	ff 75 0c             	pushl  0xc(%ebp)
f01051ab:	ff 75 08             	pushl  0x8(%ebp)
f01051ae:	e8 05 00 00 00       	call   f01051b8 <vprintfmt>
}
f01051b3:	83 c4 10             	add    $0x10,%esp
f01051b6:	c9                   	leave  
f01051b7:	c3                   	ret    

f01051b8 <vprintfmt>:
{
f01051b8:	f3 0f 1e fb          	endbr32 
f01051bc:	55                   	push   %ebp
f01051bd:	89 e5                	mov    %esp,%ebp
f01051bf:	57                   	push   %edi
f01051c0:	56                   	push   %esi
f01051c1:	53                   	push   %ebx
f01051c2:	83 ec 3c             	sub    $0x3c,%esp
f01051c5:	8b 75 08             	mov    0x8(%ebp),%esi
f01051c8:	8b 5d 0c             	mov    0xc(%ebp),%ebx
f01051cb:	8b 7d 10             	mov    0x10(%ebp),%edi
f01051ce:	e9 5d 03 00 00       	jmp    f0105530 <vprintfmt+0x378>
		padc = ' ';
f01051d3:	c6 45 d3 20          	movb   $0x20,-0x2d(%ebp)
		altflag = 0;
f01051d7:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
		precision = -1;
f01051de:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
		width = -1;
f01051e5:	c7 45 d4 ff ff ff ff 	movl   $0xffffffff,-0x2c(%ebp)
		lflag = 0;
f01051ec:	b9 00 00 00 00       	mov    $0x0,%ecx
		switch (ch = *(unsigned char *) fmt++) {
f01051f1:	8d 47 01             	lea    0x1(%edi),%eax
f01051f4:	89 45 e4             	mov    %eax,-0x1c(%ebp)
f01051f7:	0f b6 17             	movzbl (%edi),%edx
f01051fa:	8d 42 dd             	lea    -0x23(%edx),%eax
f01051fd:	3c 55                	cmp    $0x55,%al
f01051ff:	0f 87 ae 03 00 00    	ja     f01055b3 <vprintfmt+0x3fb>
f0105205:	0f b6 c0             	movzbl %al,%eax
f0105208:	3e ff 24 85 c0 7d 10 	notrack jmp *-0xfef8240(,%eax,4)
f010520f:	f0 
f0105210:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			padc = '-';
f0105213:	c6 45 d3 2d          	movb   $0x2d,-0x2d(%ebp)
f0105217:	eb d8                	jmp    f01051f1 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
f0105219:	8b 7d e4             	mov    -0x1c(%ebp),%edi
f010521c:	c6 45 d3 30          	movb   $0x30,-0x2d(%ebp)
f0105220:	eb cf                	jmp    f01051f1 <vprintfmt+0x39>
f0105222:	0f b6 d2             	movzbl %dl,%edx
f0105225:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			for (precision = 0; ; ++fmt) {
f0105228:	b8 00 00 00 00       	mov    $0x0,%eax
f010522d:	89 4d e4             	mov    %ecx,-0x1c(%ebp)
				precision = precision * 10 + ch - '0';
f0105230:	8d 04 80             	lea    (%eax,%eax,4),%eax
f0105233:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
				ch = *fmt;
f0105237:	0f be 17             	movsbl (%edi),%edx
				if (ch < '0' || ch > '9')
f010523a:	8d 4a d0             	lea    -0x30(%edx),%ecx
f010523d:	83 f9 09             	cmp    $0x9,%ecx
f0105240:	77 55                	ja     f0105297 <vprintfmt+0xdf>
			for (precision = 0; ; ++fmt) {
f0105242:	83 c7 01             	add    $0x1,%edi
				precision = precision * 10 + ch - '0';
f0105245:	eb e9                	jmp    f0105230 <vprintfmt+0x78>
			precision = va_arg(ap, int);
f0105247:	8b 45 14             	mov    0x14(%ebp),%eax
f010524a:	8b 00                	mov    (%eax),%eax
f010524c:	89 45 d8             	mov    %eax,-0x28(%ebp)
f010524f:	8b 45 14             	mov    0x14(%ebp),%eax
f0105252:	8d 40 04             	lea    0x4(%eax),%eax
f0105255:	89 45 14             	mov    %eax,0x14(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
f0105258:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			if (width < 0)
f010525b:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
f010525f:	79 90                	jns    f01051f1 <vprintfmt+0x39>
				width = precision, precision = -1;
f0105261:	8b 45 d8             	mov    -0x28(%ebp),%eax
f0105264:	89 45 d4             	mov    %eax,-0x2c(%ebp)
f0105267:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
f010526e:	eb 81                	jmp    f01051f1 <vprintfmt+0x39>
f0105270:	8b 45 d4             	mov    -0x2c(%ebp),%eax
f0105273:	85 c0                	test   %eax,%eax
f0105275:	ba 00 00 00 00       	mov    $0x0,%edx
f010527a:	0f 49 d0             	cmovns %eax,%edx
f010527d:	89 55 d4             	mov    %edx,-0x2c(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
f0105280:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
f0105283:	e9 69 ff ff ff       	jmp    f01051f1 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
f0105288:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			altflag = 1;
f010528b:	c7 45 e0 01 00 00 00 	movl   $0x1,-0x20(%ebp)
			goto reswitch;
f0105292:	e9 5a ff ff ff       	jmp    f01051f1 <vprintfmt+0x39>
f0105297:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
f010529a:	89 45 d8             	mov    %eax,-0x28(%ebp)
f010529d:	eb bc                	jmp    f010525b <vprintfmt+0xa3>
			lflag++;
f010529f:	83 c1 01             	add    $0x1,%ecx
		switch (ch = *(unsigned char *) fmt++) {
f01052a2:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
f01052a5:	e9 47 ff ff ff       	jmp    f01051f1 <vprintfmt+0x39>
			putch(va_arg(ap, int), putdat);
f01052aa:	8b 45 14             	mov    0x14(%ebp),%eax
f01052ad:	8d 78 04             	lea    0x4(%eax),%edi
f01052b0:	83 ec 08             	sub    $0x8,%esp
f01052b3:	53                   	push   %ebx
f01052b4:	ff 30                	pushl  (%eax)
f01052b6:	ff d6                	call   *%esi
			break;
f01052b8:	83 c4 10             	add    $0x10,%esp
			putch(va_arg(ap, int), putdat);
f01052bb:	89 7d 14             	mov    %edi,0x14(%ebp)
			break;
f01052be:	e9 6a 02 00 00       	jmp    f010552d <vprintfmt+0x375>
			err = va_arg(ap, int);
f01052c3:	8b 45 14             	mov    0x14(%ebp),%eax
f01052c6:	8d 78 04             	lea    0x4(%eax),%edi
f01052c9:	8b 00                	mov    (%eax),%eax
f01052cb:	99                   	cltd   
f01052cc:	31 d0                	xor    %edx,%eax
f01052ce:	29 d0                	sub    %edx,%eax
			if (err >= MAXERROR || (p = error_string[err]) == NULL)
f01052d0:	83 f8 0f             	cmp    $0xf,%eax
f01052d3:	7f 23                	jg     f01052f8 <vprintfmt+0x140>
f01052d5:	8b 14 85 20 7f 10 f0 	mov    -0xfef80e0(,%eax,4),%edx
f01052dc:	85 d2                	test   %edx,%edx
f01052de:	74 18                	je     f01052f8 <vprintfmt+0x140>
				printfmt(putch, putdat, "%s", p);
f01052e0:	52                   	push   %edx
f01052e1:	68 59 74 10 f0       	push   $0xf0107459
f01052e6:	53                   	push   %ebx
f01052e7:	56                   	push   %esi
f01052e8:	e8 aa fe ff ff       	call   f0105197 <printfmt>
f01052ed:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
f01052f0:	89 7d 14             	mov    %edi,0x14(%ebp)
f01052f3:	e9 35 02 00 00       	jmp    f010552d <vprintfmt+0x375>
				printfmt(putch, putdat, "error %d", err);
f01052f8:	50                   	push   %eax
f01052f9:	68 92 7c 10 f0       	push   $0xf0107c92
f01052fe:	53                   	push   %ebx
f01052ff:	56                   	push   %esi
f0105300:	e8 92 fe ff ff       	call   f0105197 <printfmt>
f0105305:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
f0105308:	89 7d 14             	mov    %edi,0x14(%ebp)
				printfmt(putch, putdat, "error %d", err);
f010530b:	e9 1d 02 00 00       	jmp    f010552d <vprintfmt+0x375>
			if ((p = va_arg(ap, char *)) == NULL)
f0105310:	8b 45 14             	mov    0x14(%ebp),%eax
f0105313:	83 c0 04             	add    $0x4,%eax
f0105316:	89 45 c8             	mov    %eax,-0x38(%ebp)
f0105319:	8b 45 14             	mov    0x14(%ebp),%eax
f010531c:	8b 10                	mov    (%eax),%edx
				p = "(null)";
f010531e:	85 d2                	test   %edx,%edx
f0105320:	b8 8b 7c 10 f0       	mov    $0xf0107c8b,%eax
f0105325:	0f 45 c2             	cmovne %edx,%eax
f0105328:	89 45 cc             	mov    %eax,-0x34(%ebp)
			if (width > 0 && padc != '-')
f010532b:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
f010532f:	7e 06                	jle    f0105337 <vprintfmt+0x17f>
f0105331:	80 7d d3 2d          	cmpb   $0x2d,-0x2d(%ebp)
f0105335:	75 0d                	jne    f0105344 <vprintfmt+0x18c>
				for (width -= strnlen(p, precision); width > 0; width--)
f0105337:	8b 45 cc             	mov    -0x34(%ebp),%eax
f010533a:	89 c7                	mov    %eax,%edi
f010533c:	03 45 d4             	add    -0x2c(%ebp),%eax
f010533f:	89 45 d4             	mov    %eax,-0x2c(%ebp)
f0105342:	eb 55                	jmp    f0105399 <vprintfmt+0x1e1>
f0105344:	83 ec 08             	sub    $0x8,%esp
f0105347:	ff 75 d8             	pushl  -0x28(%ebp)
f010534a:	ff 75 cc             	pushl  -0x34(%ebp)
f010534d:	e8 07 04 00 00       	call   f0105759 <strnlen>
f0105352:	8b 55 d4             	mov    -0x2c(%ebp),%edx
f0105355:	29 c2                	sub    %eax,%edx
f0105357:	89 55 c4             	mov    %edx,-0x3c(%ebp)
f010535a:	83 c4 10             	add    $0x10,%esp
f010535d:	89 d7                	mov    %edx,%edi
					putch(padc, putdat);
f010535f:	0f be 45 d3          	movsbl -0x2d(%ebp),%eax
f0105363:	89 45 d4             	mov    %eax,-0x2c(%ebp)
				for (width -= strnlen(p, precision); width > 0; width--)
f0105366:	85 ff                	test   %edi,%edi
f0105368:	7e 11                	jle    f010537b <vprintfmt+0x1c3>
					putch(padc, putdat);
f010536a:	83 ec 08             	sub    $0x8,%esp
f010536d:	53                   	push   %ebx
f010536e:	ff 75 d4             	pushl  -0x2c(%ebp)
f0105371:	ff d6                	call   *%esi
				for (width -= strnlen(p, precision); width > 0; width--)
f0105373:	83 ef 01             	sub    $0x1,%edi
f0105376:	83 c4 10             	add    $0x10,%esp
f0105379:	eb eb                	jmp    f0105366 <vprintfmt+0x1ae>
f010537b:	8b 55 c4             	mov    -0x3c(%ebp),%edx
f010537e:	85 d2                	test   %edx,%edx
f0105380:	b8 00 00 00 00       	mov    $0x0,%eax
f0105385:	0f 49 c2             	cmovns %edx,%eax
f0105388:	29 c2                	sub    %eax,%edx
f010538a:	89 55 d4             	mov    %edx,-0x2c(%ebp)
f010538d:	eb a8                	jmp    f0105337 <vprintfmt+0x17f>
					putch(ch, putdat);
f010538f:	83 ec 08             	sub    $0x8,%esp
f0105392:	53                   	push   %ebx
f0105393:	52                   	push   %edx
f0105394:	ff d6                	call   *%esi
f0105396:	83 c4 10             	add    $0x10,%esp
f0105399:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
f010539c:	29 f9                	sub    %edi,%ecx
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
f010539e:	83 c7 01             	add    $0x1,%edi
f01053a1:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
f01053a5:	0f be d0             	movsbl %al,%edx
f01053a8:	85 d2                	test   %edx,%edx
f01053aa:	74 4b                	je     f01053f7 <vprintfmt+0x23f>
f01053ac:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
f01053b0:	78 06                	js     f01053b8 <vprintfmt+0x200>
f01053b2:	83 6d d8 01          	subl   $0x1,-0x28(%ebp)
f01053b6:	78 1e                	js     f01053d6 <vprintfmt+0x21e>
				if (altflag && (ch < ' ' || ch > '~'))
f01053b8:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
f01053bc:	74 d1                	je     f010538f <vprintfmt+0x1d7>
f01053be:	0f be c0             	movsbl %al,%eax
f01053c1:	83 e8 20             	sub    $0x20,%eax
f01053c4:	83 f8 5e             	cmp    $0x5e,%eax
f01053c7:	76 c6                	jbe    f010538f <vprintfmt+0x1d7>
					putch('?', putdat);
f01053c9:	83 ec 08             	sub    $0x8,%esp
f01053cc:	53                   	push   %ebx
f01053cd:	6a 3f                	push   $0x3f
f01053cf:	ff d6                	call   *%esi
f01053d1:	83 c4 10             	add    $0x10,%esp
f01053d4:	eb c3                	jmp    f0105399 <vprintfmt+0x1e1>
f01053d6:	89 cf                	mov    %ecx,%edi
f01053d8:	eb 0e                	jmp    f01053e8 <vprintfmt+0x230>
				putch(' ', putdat);
f01053da:	83 ec 08             	sub    $0x8,%esp
f01053dd:	53                   	push   %ebx
f01053de:	6a 20                	push   $0x20
f01053e0:	ff d6                	call   *%esi
			for (; width > 0; width--)
f01053e2:	83 ef 01             	sub    $0x1,%edi
f01053e5:	83 c4 10             	add    $0x10,%esp
f01053e8:	85 ff                	test   %edi,%edi
f01053ea:	7f ee                	jg     f01053da <vprintfmt+0x222>
			if ((p = va_arg(ap, char *)) == NULL)
f01053ec:	8b 45 c8             	mov    -0x38(%ebp),%eax
f01053ef:	89 45 14             	mov    %eax,0x14(%ebp)
f01053f2:	e9 36 01 00 00       	jmp    f010552d <vprintfmt+0x375>
f01053f7:	89 cf                	mov    %ecx,%edi
f01053f9:	eb ed                	jmp    f01053e8 <vprintfmt+0x230>
	if (lflag >= 2)
f01053fb:	83 f9 01             	cmp    $0x1,%ecx
f01053fe:	7f 1f                	jg     f010541f <vprintfmt+0x267>
	else if (lflag)
f0105400:	85 c9                	test   %ecx,%ecx
f0105402:	74 67                	je     f010546b <vprintfmt+0x2b3>
		return va_arg(*ap, long);
f0105404:	8b 45 14             	mov    0x14(%ebp),%eax
f0105407:	8b 00                	mov    (%eax),%eax
f0105409:	89 45 d8             	mov    %eax,-0x28(%ebp)
f010540c:	89 c1                	mov    %eax,%ecx
f010540e:	c1 f9 1f             	sar    $0x1f,%ecx
f0105411:	89 4d dc             	mov    %ecx,-0x24(%ebp)
f0105414:	8b 45 14             	mov    0x14(%ebp),%eax
f0105417:	8d 40 04             	lea    0x4(%eax),%eax
f010541a:	89 45 14             	mov    %eax,0x14(%ebp)
f010541d:	eb 17                	jmp    f0105436 <vprintfmt+0x27e>
		return va_arg(*ap, long long);
f010541f:	8b 45 14             	mov    0x14(%ebp),%eax
f0105422:	8b 50 04             	mov    0x4(%eax),%edx
f0105425:	8b 00                	mov    (%eax),%eax
f0105427:	89 45 d8             	mov    %eax,-0x28(%ebp)
f010542a:	89 55 dc             	mov    %edx,-0x24(%ebp)
f010542d:	8b 45 14             	mov    0x14(%ebp),%eax
f0105430:	8d 40 08             	lea    0x8(%eax),%eax
f0105433:	89 45 14             	mov    %eax,0x14(%ebp)
			if ((long long) num < 0) {
f0105436:	8b 55 d8             	mov    -0x28(%ebp),%edx
f0105439:	8b 4d dc             	mov    -0x24(%ebp),%ecx
			base = 10;
f010543c:	b8 0a 00 00 00       	mov    $0xa,%eax
			if ((long long) num < 0) {
f0105441:	85 c9                	test   %ecx,%ecx
f0105443:	0f 89 ca 00 00 00    	jns    f0105513 <vprintfmt+0x35b>
				putch('-', putdat);
f0105449:	83 ec 08             	sub    $0x8,%esp
f010544c:	53                   	push   %ebx
f010544d:	6a 2d                	push   $0x2d
f010544f:	ff d6                	call   *%esi
				num = -(long long) num;
f0105451:	8b 55 d8             	mov    -0x28(%ebp),%edx
f0105454:	8b 4d dc             	mov    -0x24(%ebp),%ecx
f0105457:	f7 da                	neg    %edx
f0105459:	83 d1 00             	adc    $0x0,%ecx
f010545c:	f7 d9                	neg    %ecx
f010545e:	83 c4 10             	add    $0x10,%esp
			base = 10;
f0105461:	b8 0a 00 00 00       	mov    $0xa,%eax
f0105466:	e9 a8 00 00 00       	jmp    f0105513 <vprintfmt+0x35b>
		return va_arg(*ap, int);
f010546b:	8b 45 14             	mov    0x14(%ebp),%eax
f010546e:	8b 00                	mov    (%eax),%eax
f0105470:	89 45 d8             	mov    %eax,-0x28(%ebp)
f0105473:	99                   	cltd   
f0105474:	89 55 dc             	mov    %edx,-0x24(%ebp)
f0105477:	8b 45 14             	mov    0x14(%ebp),%eax
f010547a:	8d 40 04             	lea    0x4(%eax),%eax
f010547d:	89 45 14             	mov    %eax,0x14(%ebp)
f0105480:	eb b4                	jmp    f0105436 <vprintfmt+0x27e>
	if (lflag >= 2)
f0105482:	83 f9 01             	cmp    $0x1,%ecx
f0105485:	7f 1b                	jg     f01054a2 <vprintfmt+0x2ea>
	else if (lflag)
f0105487:	85 c9                	test   %ecx,%ecx
f0105489:	74 2c                	je     f01054b7 <vprintfmt+0x2ff>
		return va_arg(*ap, unsigned long);
f010548b:	8b 45 14             	mov    0x14(%ebp),%eax
f010548e:	8b 10                	mov    (%eax),%edx
f0105490:	b9 00 00 00 00       	mov    $0x0,%ecx
f0105495:	8d 40 04             	lea    0x4(%eax),%eax
f0105498:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
f010549b:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long);
f01054a0:	eb 71                	jmp    f0105513 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
f01054a2:	8b 45 14             	mov    0x14(%ebp),%eax
f01054a5:	8b 10                	mov    (%eax),%edx
f01054a7:	8b 48 04             	mov    0x4(%eax),%ecx
f01054aa:	8d 40 08             	lea    0x8(%eax),%eax
f01054ad:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
f01054b0:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long long);
f01054b5:	eb 5c                	jmp    f0105513 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
f01054b7:	8b 45 14             	mov    0x14(%ebp),%eax
f01054ba:	8b 10                	mov    (%eax),%edx
f01054bc:	b9 00 00 00 00       	mov    $0x0,%ecx
f01054c1:	8d 40 04             	lea    0x4(%eax),%eax
f01054c4:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
f01054c7:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned int);
f01054cc:	eb 45                	jmp    f0105513 <vprintfmt+0x35b>
			putch('X', putdat);
f01054ce:	83 ec 08             	sub    $0x8,%esp
f01054d1:	53                   	push   %ebx
f01054d2:	6a 58                	push   $0x58
f01054d4:	ff d6                	call   *%esi
			putch('X', putdat);
f01054d6:	83 c4 08             	add    $0x8,%esp
f01054d9:	53                   	push   %ebx
f01054da:	6a 58                	push   $0x58
f01054dc:	ff d6                	call   *%esi
			putch('X', putdat);
f01054de:	83 c4 08             	add    $0x8,%esp
f01054e1:	53                   	push   %ebx
f01054e2:	6a 58                	push   $0x58
f01054e4:	ff d6                	call   *%esi
			break;
f01054e6:	83 c4 10             	add    $0x10,%esp
f01054e9:	eb 42                	jmp    f010552d <vprintfmt+0x375>
			putch('0', putdat);
f01054eb:	83 ec 08             	sub    $0x8,%esp
f01054ee:	53                   	push   %ebx
f01054ef:	6a 30                	push   $0x30
f01054f1:	ff d6                	call   *%esi
			putch('x', putdat);
f01054f3:	83 c4 08             	add    $0x8,%esp
f01054f6:	53                   	push   %ebx
f01054f7:	6a 78                	push   $0x78
f01054f9:	ff d6                	call   *%esi
			num = (unsigned long long)
f01054fb:	8b 45 14             	mov    0x14(%ebp),%eax
f01054fe:	8b 10                	mov    (%eax),%edx
f0105500:	b9 00 00 00 00       	mov    $0x0,%ecx
			goto number;
f0105505:	83 c4 10             	add    $0x10,%esp
				(uintptr_t) va_arg(ap, void *);
f0105508:	8d 40 04             	lea    0x4(%eax),%eax
f010550b:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
f010550e:	b8 10 00 00 00       	mov    $0x10,%eax
			printnum(putch, putdat, num, base, width, padc);
f0105513:	83 ec 0c             	sub    $0xc,%esp
f0105516:	0f be 7d d3          	movsbl -0x2d(%ebp),%edi
f010551a:	57                   	push   %edi
f010551b:	ff 75 d4             	pushl  -0x2c(%ebp)
f010551e:	50                   	push   %eax
f010551f:	51                   	push   %ecx
f0105520:	52                   	push   %edx
f0105521:	89 da                	mov    %ebx,%edx
f0105523:	89 f0                	mov    %esi,%eax
f0105525:	e8 a3 fb ff ff       	call   f01050cd <printnum>
			break;
f010552a:	83 c4 20             	add    $0x20,%esp
			if ((p = va_arg(ap, char *)) == NULL)
f010552d:	8b 7d e4             	mov    -0x1c(%ebp),%edi
		while ((ch = *(unsigned char *) fmt++) != '%') {
f0105530:	83 c7 01             	add    $0x1,%edi
f0105533:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
f0105537:	83 f8 25             	cmp    $0x25,%eax
f010553a:	0f 84 93 fc ff ff    	je     f01051d3 <vprintfmt+0x1b>
			if (ch == '\0')
f0105540:	85 c0                	test   %eax,%eax
f0105542:	0f 84 8b 00 00 00    	je     f01055d3 <vprintfmt+0x41b>
			putch(ch, putdat);
f0105548:	83 ec 08             	sub    $0x8,%esp
f010554b:	53                   	push   %ebx
f010554c:	50                   	push   %eax
f010554d:	ff d6                	call   *%esi
f010554f:	83 c4 10             	add    $0x10,%esp
f0105552:	eb dc                	jmp    f0105530 <vprintfmt+0x378>
	if (lflag >= 2)
f0105554:	83 f9 01             	cmp    $0x1,%ecx
f0105557:	7f 1b                	jg     f0105574 <vprintfmt+0x3bc>
	else if (lflag)
f0105559:	85 c9                	test   %ecx,%ecx
f010555b:	74 2c                	je     f0105589 <vprintfmt+0x3d1>
		return va_arg(*ap, unsigned long);
f010555d:	8b 45 14             	mov    0x14(%ebp),%eax
f0105560:	8b 10                	mov    (%eax),%edx
f0105562:	b9 00 00 00 00       	mov    $0x0,%ecx
f0105567:	8d 40 04             	lea    0x4(%eax),%eax
f010556a:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
f010556d:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long);
f0105572:	eb 9f                	jmp    f0105513 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
f0105574:	8b 45 14             	mov    0x14(%ebp),%eax
f0105577:	8b 10                	mov    (%eax),%edx
f0105579:	8b 48 04             	mov    0x4(%eax),%ecx
f010557c:	8d 40 08             	lea    0x8(%eax),%eax
f010557f:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
f0105582:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long long);
f0105587:	eb 8a                	jmp    f0105513 <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
f0105589:	8b 45 14             	mov    0x14(%ebp),%eax
f010558c:	8b 10                	mov    (%eax),%edx
f010558e:	b9 00 00 00 00       	mov    $0x0,%ecx
f0105593:	8d 40 04             	lea    0x4(%eax),%eax
f0105596:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
f0105599:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned int);
f010559e:	e9 70 ff ff ff       	jmp    f0105513 <vprintfmt+0x35b>
			putch(ch, putdat);
f01055a3:	83 ec 08             	sub    $0x8,%esp
f01055a6:	53                   	push   %ebx
f01055a7:	6a 25                	push   $0x25
f01055a9:	ff d6                	call   *%esi
			break;
f01055ab:	83 c4 10             	add    $0x10,%esp
f01055ae:	e9 7a ff ff ff       	jmp    f010552d <vprintfmt+0x375>
			putch('%', putdat);
f01055b3:	83 ec 08             	sub    $0x8,%esp
f01055b6:	53                   	push   %ebx
f01055b7:	6a 25                	push   $0x25
f01055b9:	ff d6                	call   *%esi
			for (fmt--; fmt[-1] != '%'; fmt--)
f01055bb:	83 c4 10             	add    $0x10,%esp
f01055be:	89 f8                	mov    %edi,%eax
f01055c0:	80 78 ff 25          	cmpb   $0x25,-0x1(%eax)
f01055c4:	74 05                	je     f01055cb <vprintfmt+0x413>
f01055c6:	83 e8 01             	sub    $0x1,%eax
f01055c9:	eb f5                	jmp    f01055c0 <vprintfmt+0x408>
f01055cb:	89 45 e4             	mov    %eax,-0x1c(%ebp)
f01055ce:	e9 5a ff ff ff       	jmp    f010552d <vprintfmt+0x375>
}
f01055d3:	8d 65 f4             	lea    -0xc(%ebp),%esp
f01055d6:	5b                   	pop    %ebx
f01055d7:	5e                   	pop    %esi
f01055d8:	5f                   	pop    %edi
f01055d9:	5d                   	pop    %ebp
f01055da:	c3                   	ret    

f01055db <vsnprintf>:

int
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
f01055db:	f3 0f 1e fb          	endbr32 
f01055df:	55                   	push   %ebp
f01055e0:	89 e5                	mov    %esp,%ebp
f01055e2:	83 ec 18             	sub    $0x18,%esp
f01055e5:	8b 45 08             	mov    0x8(%ebp),%eax
f01055e8:	8b 55 0c             	mov    0xc(%ebp),%edx
	struct sprintbuf b = {buf, buf+n-1, 0};
f01055eb:	89 45 ec             	mov    %eax,-0x14(%ebp)
f01055ee:	8d 4c 10 ff          	lea    -0x1(%eax,%edx,1),%ecx
f01055f2:	89 4d f0             	mov    %ecx,-0x10(%ebp)
f01055f5:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

	if (buf == NULL || n < 1)
f01055fc:	85 c0                	test   %eax,%eax
f01055fe:	74 26                	je     f0105626 <vsnprintf+0x4b>
f0105600:	85 d2                	test   %edx,%edx
f0105602:	7e 22                	jle    f0105626 <vsnprintf+0x4b>
		return -E_INVAL;

	// print the string to the buffer
	vprintfmt((void*)sprintputch, &b, fmt, ap);
f0105604:	ff 75 14             	pushl  0x14(%ebp)
f0105607:	ff 75 10             	pushl  0x10(%ebp)
f010560a:	8d 45 ec             	lea    -0x14(%ebp),%eax
f010560d:	50                   	push   %eax
f010560e:	68 76 51 10 f0       	push   $0xf0105176
f0105613:	e8 a0 fb ff ff       	call   f01051b8 <vprintfmt>

	// null terminate the buffer
	*b.buf = '\0';
f0105618:	8b 45 ec             	mov    -0x14(%ebp),%eax
f010561b:	c6 00 00             	movb   $0x0,(%eax)

	return b.cnt;
f010561e:	8b 45 f4             	mov    -0xc(%ebp),%eax
f0105621:	83 c4 10             	add    $0x10,%esp
}
f0105624:	c9                   	leave  
f0105625:	c3                   	ret    
		return -E_INVAL;
f0105626:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
f010562b:	eb f7                	jmp    f0105624 <vsnprintf+0x49>

f010562d <snprintf>:

int
snprintf(char *buf, int n, const char *fmt, ...)
{
f010562d:	f3 0f 1e fb          	endbr32 
f0105631:	55                   	push   %ebp
f0105632:	89 e5                	mov    %esp,%ebp
f0105634:	83 ec 08             	sub    $0x8,%esp
	va_list ap;
	int rc;

	va_start(ap, fmt);
f0105637:	8d 45 14             	lea    0x14(%ebp),%eax
	rc = vsnprintf(buf, n, fmt, ap);
f010563a:	50                   	push   %eax
f010563b:	ff 75 10             	pushl  0x10(%ebp)
f010563e:	ff 75 0c             	pushl  0xc(%ebp)
f0105641:	ff 75 08             	pushl  0x8(%ebp)
f0105644:	e8 92 ff ff ff       	call   f01055db <vsnprintf>
	va_end(ap);

	return rc;
}
f0105649:	c9                   	leave  
f010564a:	c3                   	ret    

f010564b <readline>:
#define BUFLEN 1024
static char buf[BUFLEN];

char *
readline(const char *prompt)
{
f010564b:	f3 0f 1e fb          	endbr32 
f010564f:	55                   	push   %ebp
f0105650:	89 e5                	mov    %esp,%ebp
f0105652:	57                   	push   %edi
f0105653:	56                   	push   %esi
f0105654:	53                   	push   %ebx
f0105655:	83 ec 0c             	sub    $0xc,%esp
f0105658:	8b 45 08             	mov    0x8(%ebp),%eax
	int i, c, echoing;

#if JOS_KERNEL
	if (prompt != NULL)
f010565b:	85 c0                	test   %eax,%eax
f010565d:	74 11                	je     f0105670 <readline+0x25>
		cprintf("%s", prompt);
f010565f:	83 ec 08             	sub    $0x8,%esp
f0105662:	50                   	push   %eax
f0105663:	68 59 74 10 f0       	push   $0xf0107459
f0105668:	e8 70 e1 ff ff       	call   f01037dd <cprintf>
f010566d:	83 c4 10             	add    $0x10,%esp
	if (prompt != NULL)
		fprintf(1, "%s", prompt);
#endif

	i = 0;
	echoing = iscons(0);
f0105670:	83 ec 0c             	sub    $0xc,%esp
f0105673:	6a 00                	push   $0x0
f0105675:	e8 58 b1 ff ff       	call   f01007d2 <iscons>
f010567a:	89 c7                	mov    %eax,%edi
f010567c:	83 c4 10             	add    $0x10,%esp
	i = 0;
f010567f:	be 00 00 00 00       	mov    $0x0,%esi
f0105684:	eb 57                	jmp    f01056dd <readline+0x92>
	while (1) {
		c = getchar();
		if (c < 0) {
			if (c != -E_EOF)
				cprintf("read error: %e\n", c);
			return NULL;
f0105686:	b8 00 00 00 00       	mov    $0x0,%eax
			if (c != -E_EOF)
f010568b:	83 fb f8             	cmp    $0xfffffff8,%ebx
f010568e:	75 08                	jne    f0105698 <readline+0x4d>
				cputchar('\n');
			buf[i] = 0;
			return buf;
		}
	}
}
f0105690:	8d 65 f4             	lea    -0xc(%ebp),%esp
f0105693:	5b                   	pop    %ebx
f0105694:	5e                   	pop    %esi
f0105695:	5f                   	pop    %edi
f0105696:	5d                   	pop    %ebp
f0105697:	c3                   	ret    
				cprintf("read error: %e\n", c);
f0105698:	83 ec 08             	sub    $0x8,%esp
f010569b:	53                   	push   %ebx
f010569c:	68 7f 7f 10 f0       	push   $0xf0107f7f
f01056a1:	e8 37 e1 ff ff       	call   f01037dd <cprintf>
f01056a6:	83 c4 10             	add    $0x10,%esp
			return NULL;
f01056a9:	b8 00 00 00 00       	mov    $0x0,%eax
f01056ae:	eb e0                	jmp    f0105690 <readline+0x45>
			if (echoing)
f01056b0:	85 ff                	test   %edi,%edi
f01056b2:	75 05                	jne    f01056b9 <readline+0x6e>
			i--;
f01056b4:	83 ee 01             	sub    $0x1,%esi
f01056b7:	eb 24                	jmp    f01056dd <readline+0x92>
				cputchar('\b');
f01056b9:	83 ec 0c             	sub    $0xc,%esp
f01056bc:	6a 08                	push   $0x8
f01056be:	e8 e6 b0 ff ff       	call   f01007a9 <cputchar>
f01056c3:	83 c4 10             	add    $0x10,%esp
f01056c6:	eb ec                	jmp    f01056b4 <readline+0x69>
				cputchar(c);
f01056c8:	83 ec 0c             	sub    $0xc,%esp
f01056cb:	53                   	push   %ebx
f01056cc:	e8 d8 b0 ff ff       	call   f01007a9 <cputchar>
f01056d1:	83 c4 10             	add    $0x10,%esp
			buf[i++] = c;
f01056d4:	88 9e 80 7a 21 f0    	mov    %bl,-0xfde8580(%esi)
f01056da:	8d 76 01             	lea    0x1(%esi),%esi
		c = getchar();
f01056dd:	e8 db b0 ff ff       	call   f01007bd <getchar>
f01056e2:	89 c3                	mov    %eax,%ebx
		if (c < 0) {
f01056e4:	85 c0                	test   %eax,%eax
f01056e6:	78 9e                	js     f0105686 <readline+0x3b>
		} else if ((c == '\b' || c == '\x7f') && i > 0) {
f01056e8:	83 f8 08             	cmp    $0x8,%eax
f01056eb:	0f 94 c2             	sete   %dl
f01056ee:	83 f8 7f             	cmp    $0x7f,%eax
f01056f1:	0f 94 c0             	sete   %al
f01056f4:	08 c2                	or     %al,%dl
f01056f6:	74 04                	je     f01056fc <readline+0xb1>
f01056f8:	85 f6                	test   %esi,%esi
f01056fa:	7f b4                	jg     f01056b0 <readline+0x65>
		} else if (c >= ' ' && i < BUFLEN-1) {
f01056fc:	83 fb 1f             	cmp    $0x1f,%ebx
f01056ff:	7e 0e                	jle    f010570f <readline+0xc4>
f0105701:	81 fe fe 03 00 00    	cmp    $0x3fe,%esi
f0105707:	7f 06                	jg     f010570f <readline+0xc4>
			if (echoing)
f0105709:	85 ff                	test   %edi,%edi
f010570b:	74 c7                	je     f01056d4 <readline+0x89>
f010570d:	eb b9                	jmp    f01056c8 <readline+0x7d>
		} else if (c == '\n' || c == '\r') {
f010570f:	83 fb 0a             	cmp    $0xa,%ebx
f0105712:	74 05                	je     f0105719 <readline+0xce>
f0105714:	83 fb 0d             	cmp    $0xd,%ebx
f0105717:	75 c4                	jne    f01056dd <readline+0x92>
			if (echoing)
f0105719:	85 ff                	test   %edi,%edi
f010571b:	75 11                	jne    f010572e <readline+0xe3>
			buf[i] = 0;
f010571d:	c6 86 80 7a 21 f0 00 	movb   $0x0,-0xfde8580(%esi)
			return buf;
f0105724:	b8 80 7a 21 f0       	mov    $0xf0217a80,%eax
f0105729:	e9 62 ff ff ff       	jmp    f0105690 <readline+0x45>
				cputchar('\n');
f010572e:	83 ec 0c             	sub    $0xc,%esp
f0105731:	6a 0a                	push   $0xa
f0105733:	e8 71 b0 ff ff       	call   f01007a9 <cputchar>
f0105738:	83 c4 10             	add    $0x10,%esp
f010573b:	eb e0                	jmp    f010571d <readline+0xd2>

f010573d <strlen>:
// Primespipe runs 3x faster this way.
#define ASM 1

int
strlen(const char *s)
{
f010573d:	f3 0f 1e fb          	endbr32 
f0105741:	55                   	push   %ebp
f0105742:	89 e5                	mov    %esp,%ebp
f0105744:	8b 55 08             	mov    0x8(%ebp),%edx
	int n;

	for (n = 0; *s != '\0'; s++)
f0105747:	b8 00 00 00 00       	mov    $0x0,%eax
f010574c:	80 3c 02 00          	cmpb   $0x0,(%edx,%eax,1)
f0105750:	74 05                	je     f0105757 <strlen+0x1a>
		n++;
f0105752:	83 c0 01             	add    $0x1,%eax
f0105755:	eb f5                	jmp    f010574c <strlen+0xf>
	return n;
}
f0105757:	5d                   	pop    %ebp
f0105758:	c3                   	ret    

f0105759 <strnlen>:

int
strnlen(const char *s, size_t size)
{
f0105759:	f3 0f 1e fb          	endbr32 
f010575d:	55                   	push   %ebp
f010575e:	89 e5                	mov    %esp,%ebp
f0105760:	8b 4d 08             	mov    0x8(%ebp),%ecx
f0105763:	8b 55 0c             	mov    0xc(%ebp),%edx
	int n;

	for (n = 0; size > 0 && *s != '\0'; s++, size--)
f0105766:	b8 00 00 00 00       	mov    $0x0,%eax
f010576b:	39 d0                	cmp    %edx,%eax
f010576d:	74 0d                	je     f010577c <strnlen+0x23>
f010576f:	80 3c 01 00          	cmpb   $0x0,(%ecx,%eax,1)
f0105773:	74 05                	je     f010577a <strnlen+0x21>
		n++;
f0105775:	83 c0 01             	add    $0x1,%eax
f0105778:	eb f1                	jmp    f010576b <strnlen+0x12>
f010577a:	89 c2                	mov    %eax,%edx
	return n;
}
f010577c:	89 d0                	mov    %edx,%eax
f010577e:	5d                   	pop    %ebp
f010577f:	c3                   	ret    

f0105780 <strcpy>:

char *
strcpy(char *dst, const char *src)
{
f0105780:	f3 0f 1e fb          	endbr32 
f0105784:	55                   	push   %ebp
f0105785:	89 e5                	mov    %esp,%ebp
f0105787:	53                   	push   %ebx
f0105788:	8b 4d 08             	mov    0x8(%ebp),%ecx
f010578b:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	char *ret;

	ret = dst;
	while ((*dst++ = *src++) != '\0')
f010578e:	b8 00 00 00 00       	mov    $0x0,%eax
f0105793:	0f b6 14 03          	movzbl (%ebx,%eax,1),%edx
f0105797:	88 14 01             	mov    %dl,(%ecx,%eax,1)
f010579a:	83 c0 01             	add    $0x1,%eax
f010579d:	84 d2                	test   %dl,%dl
f010579f:	75 f2                	jne    f0105793 <strcpy+0x13>
		/* do nothing */;
	return ret;
}
f01057a1:	89 c8                	mov    %ecx,%eax
f01057a3:	5b                   	pop    %ebx
f01057a4:	5d                   	pop    %ebp
f01057a5:	c3                   	ret    

f01057a6 <strcat>:

char *
strcat(char *dst, const char *src)
{
f01057a6:	f3 0f 1e fb          	endbr32 
f01057aa:	55                   	push   %ebp
f01057ab:	89 e5                	mov    %esp,%ebp
f01057ad:	53                   	push   %ebx
f01057ae:	83 ec 10             	sub    $0x10,%esp
f01057b1:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int len = strlen(dst);
f01057b4:	53                   	push   %ebx
f01057b5:	e8 83 ff ff ff       	call   f010573d <strlen>
f01057ba:	83 c4 08             	add    $0x8,%esp
	strcpy(dst + len, src);
f01057bd:	ff 75 0c             	pushl  0xc(%ebp)
f01057c0:	01 d8                	add    %ebx,%eax
f01057c2:	50                   	push   %eax
f01057c3:	e8 b8 ff ff ff       	call   f0105780 <strcpy>
	return dst;
}
f01057c8:	89 d8                	mov    %ebx,%eax
f01057ca:	8b 5d fc             	mov    -0x4(%ebp),%ebx
f01057cd:	c9                   	leave  
f01057ce:	c3                   	ret    

f01057cf <strncpy>:

char *
strncpy(char *dst, const char *src, size_t size) {
f01057cf:	f3 0f 1e fb          	endbr32 
f01057d3:	55                   	push   %ebp
f01057d4:	89 e5                	mov    %esp,%ebp
f01057d6:	56                   	push   %esi
f01057d7:	53                   	push   %ebx
f01057d8:	8b 75 08             	mov    0x8(%ebp),%esi
f01057db:	8b 55 0c             	mov    0xc(%ebp),%edx
f01057de:	89 f3                	mov    %esi,%ebx
f01057e0:	03 5d 10             	add    0x10(%ebp),%ebx
	size_t i;
	char *ret;

	ret = dst;
	for (i = 0; i < size; i++) {
f01057e3:	89 f0                	mov    %esi,%eax
f01057e5:	39 d8                	cmp    %ebx,%eax
f01057e7:	74 11                	je     f01057fa <strncpy+0x2b>
		*dst++ = *src;
f01057e9:	83 c0 01             	add    $0x1,%eax
f01057ec:	0f b6 0a             	movzbl (%edx),%ecx
f01057ef:	88 48 ff             	mov    %cl,-0x1(%eax)
		// If strlen(src) < size, null-pad 'dst' out to 'size' chars
		if (*src != '\0')
			src++;
f01057f2:	80 f9 01             	cmp    $0x1,%cl
f01057f5:	83 da ff             	sbb    $0xffffffff,%edx
f01057f8:	eb eb                	jmp    f01057e5 <strncpy+0x16>
	}
	return ret;
}
f01057fa:	89 f0                	mov    %esi,%eax
f01057fc:	5b                   	pop    %ebx
f01057fd:	5e                   	pop    %esi
f01057fe:	5d                   	pop    %ebp
f01057ff:	c3                   	ret    

f0105800 <strlcpy>:

size_t
strlcpy(char *dst, const char *src, size_t size)
{
f0105800:	f3 0f 1e fb          	endbr32 
f0105804:	55                   	push   %ebp
f0105805:	89 e5                	mov    %esp,%ebp
f0105807:	56                   	push   %esi
f0105808:	53                   	push   %ebx
f0105809:	8b 75 08             	mov    0x8(%ebp),%esi
f010580c:	8b 4d 0c             	mov    0xc(%ebp),%ecx
f010580f:	8b 55 10             	mov    0x10(%ebp),%edx
f0105812:	89 f0                	mov    %esi,%eax
	char *dst_in;

	dst_in = dst;
	if (size > 0) {
f0105814:	85 d2                	test   %edx,%edx
f0105816:	74 21                	je     f0105839 <strlcpy+0x39>
f0105818:	8d 44 16 ff          	lea    -0x1(%esi,%edx,1),%eax
f010581c:	89 f2                	mov    %esi,%edx
		while (--size > 0 && *src != '\0')
f010581e:	39 c2                	cmp    %eax,%edx
f0105820:	74 14                	je     f0105836 <strlcpy+0x36>
f0105822:	0f b6 19             	movzbl (%ecx),%ebx
f0105825:	84 db                	test   %bl,%bl
f0105827:	74 0b                	je     f0105834 <strlcpy+0x34>
			*dst++ = *src++;
f0105829:	83 c1 01             	add    $0x1,%ecx
f010582c:	83 c2 01             	add    $0x1,%edx
f010582f:	88 5a ff             	mov    %bl,-0x1(%edx)
f0105832:	eb ea                	jmp    f010581e <strlcpy+0x1e>
f0105834:	89 d0                	mov    %edx,%eax
		*dst = '\0';
f0105836:	c6 00 00             	movb   $0x0,(%eax)
	}
	return dst - dst_in;
f0105839:	29 f0                	sub    %esi,%eax
}
f010583b:	5b                   	pop    %ebx
f010583c:	5e                   	pop    %esi
f010583d:	5d                   	pop    %ebp
f010583e:	c3                   	ret    

f010583f <strcmp>:

int
strcmp(const char *p, const char *q)
{
f010583f:	f3 0f 1e fb          	endbr32 
f0105843:	55                   	push   %ebp
f0105844:	89 e5                	mov    %esp,%ebp
f0105846:	8b 4d 08             	mov    0x8(%ebp),%ecx
f0105849:	8b 55 0c             	mov    0xc(%ebp),%edx
	while (*p && *p == *q)
f010584c:	0f b6 01             	movzbl (%ecx),%eax
f010584f:	84 c0                	test   %al,%al
f0105851:	74 0c                	je     f010585f <strcmp+0x20>
f0105853:	3a 02                	cmp    (%edx),%al
f0105855:	75 08                	jne    f010585f <strcmp+0x20>
		p++, q++;
f0105857:	83 c1 01             	add    $0x1,%ecx
f010585a:	83 c2 01             	add    $0x1,%edx
f010585d:	eb ed                	jmp    f010584c <strcmp+0xd>
	return (int) ((unsigned char) *p - (unsigned char) *q);
f010585f:	0f b6 c0             	movzbl %al,%eax
f0105862:	0f b6 12             	movzbl (%edx),%edx
f0105865:	29 d0                	sub    %edx,%eax
}
f0105867:	5d                   	pop    %ebp
f0105868:	c3                   	ret    

f0105869 <strncmp>:

int
strncmp(const char *p, const char *q, size_t n)
{
f0105869:	f3 0f 1e fb          	endbr32 
f010586d:	55                   	push   %ebp
f010586e:	89 e5                	mov    %esp,%ebp
f0105870:	53                   	push   %ebx
f0105871:	8b 45 08             	mov    0x8(%ebp),%eax
f0105874:	8b 55 0c             	mov    0xc(%ebp),%edx
f0105877:	89 c3                	mov    %eax,%ebx
f0105879:	03 5d 10             	add    0x10(%ebp),%ebx
	while (n > 0 && *p && *p == *q)
f010587c:	eb 06                	jmp    f0105884 <strncmp+0x1b>
		n--, p++, q++;
f010587e:	83 c0 01             	add    $0x1,%eax
f0105881:	83 c2 01             	add    $0x1,%edx
	while (n > 0 && *p && *p == *q)
f0105884:	39 d8                	cmp    %ebx,%eax
f0105886:	74 16                	je     f010589e <strncmp+0x35>
f0105888:	0f b6 08             	movzbl (%eax),%ecx
f010588b:	84 c9                	test   %cl,%cl
f010588d:	74 04                	je     f0105893 <strncmp+0x2a>
f010588f:	3a 0a                	cmp    (%edx),%cl
f0105891:	74 eb                	je     f010587e <strncmp+0x15>
	if (n == 0)
		return 0;
	else
		return (int) ((unsigned char) *p - (unsigned char) *q);
f0105893:	0f b6 00             	movzbl (%eax),%eax
f0105896:	0f b6 12             	movzbl (%edx),%edx
f0105899:	29 d0                	sub    %edx,%eax
}
f010589b:	5b                   	pop    %ebx
f010589c:	5d                   	pop    %ebp
f010589d:	c3                   	ret    
		return 0;
f010589e:	b8 00 00 00 00       	mov    $0x0,%eax
f01058a3:	eb f6                	jmp    f010589b <strncmp+0x32>

f01058a5 <strchr>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
f01058a5:	f3 0f 1e fb          	endbr32 
f01058a9:	55                   	push   %ebp
f01058aa:	89 e5                	mov    %esp,%ebp
f01058ac:	8b 45 08             	mov    0x8(%ebp),%eax
f01058af:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
f01058b3:	0f b6 10             	movzbl (%eax),%edx
f01058b6:	84 d2                	test   %dl,%dl
f01058b8:	74 09                	je     f01058c3 <strchr+0x1e>
		if (*s == c)
f01058ba:	38 ca                	cmp    %cl,%dl
f01058bc:	74 0a                	je     f01058c8 <strchr+0x23>
	for (; *s; s++)
f01058be:	83 c0 01             	add    $0x1,%eax
f01058c1:	eb f0                	jmp    f01058b3 <strchr+0xe>
			return (char *) s;
	return 0;
f01058c3:	b8 00 00 00 00       	mov    $0x0,%eax
}
f01058c8:	5d                   	pop    %ebp
f01058c9:	c3                   	ret    

f01058ca <strfind>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
f01058ca:	f3 0f 1e fb          	endbr32 
f01058ce:	55                   	push   %ebp
f01058cf:	89 e5                	mov    %esp,%ebp
f01058d1:	8b 45 08             	mov    0x8(%ebp),%eax
f01058d4:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
f01058d8:	0f b6 10             	movzbl (%eax),%edx
		if (*s == c)
f01058db:	38 ca                	cmp    %cl,%dl
f01058dd:	74 09                	je     f01058e8 <strfind+0x1e>
f01058df:	84 d2                	test   %dl,%dl
f01058e1:	74 05                	je     f01058e8 <strfind+0x1e>
	for (; *s; s++)
f01058e3:	83 c0 01             	add    $0x1,%eax
f01058e6:	eb f0                	jmp    f01058d8 <strfind+0xe>
			break;
	return (char *) s;
}
f01058e8:	5d                   	pop    %ebp
f01058e9:	c3                   	ret    

f01058ea <memset>:

#if ASM
void *
memset(void *v, int c, size_t n)
{
f01058ea:	f3 0f 1e fb          	endbr32 
f01058ee:	55                   	push   %ebp
f01058ef:	89 e5                	mov    %esp,%ebp
f01058f1:	57                   	push   %edi
f01058f2:	56                   	push   %esi
f01058f3:	53                   	push   %ebx
f01058f4:	8b 7d 08             	mov    0x8(%ebp),%edi
f01058f7:	8b 4d 10             	mov    0x10(%ebp),%ecx
	char *p;

	if (n == 0)
f01058fa:	85 c9                	test   %ecx,%ecx
f01058fc:	74 31                	je     f010592f <memset+0x45>
		return v;
	if ((int)v%4 == 0 && n%4 == 0) {
f01058fe:	89 f8                	mov    %edi,%eax
f0105900:	09 c8                	or     %ecx,%eax
f0105902:	a8 03                	test   $0x3,%al
f0105904:	75 23                	jne    f0105929 <memset+0x3f>
		c &= 0xFF;
f0105906:	0f b6 55 0c          	movzbl 0xc(%ebp),%edx
		c = (c<<24)|(c<<16)|(c<<8)|c;
f010590a:	89 d3                	mov    %edx,%ebx
f010590c:	c1 e3 08             	shl    $0x8,%ebx
f010590f:	89 d0                	mov    %edx,%eax
f0105911:	c1 e0 18             	shl    $0x18,%eax
f0105914:	89 d6                	mov    %edx,%esi
f0105916:	c1 e6 10             	shl    $0x10,%esi
f0105919:	09 f0                	or     %esi,%eax
f010591b:	09 c2                	or     %eax,%edx
f010591d:	09 da                	or     %ebx,%edx
		asm volatile("cld; rep stosl\n"
			:: "D" (v), "a" (c), "c" (n/4)
f010591f:	c1 e9 02             	shr    $0x2,%ecx
		asm volatile("cld; rep stosl\n"
f0105922:	89 d0                	mov    %edx,%eax
f0105924:	fc                   	cld    
f0105925:	f3 ab                	rep stos %eax,%es:(%edi)
f0105927:	eb 06                	jmp    f010592f <memset+0x45>
			: "cc", "memory");
	} else
		asm volatile("cld; rep stosb\n"
f0105929:	8b 45 0c             	mov    0xc(%ebp),%eax
f010592c:	fc                   	cld    
f010592d:	f3 aa                	rep stos %al,%es:(%edi)
			:: "D" (v), "a" (c), "c" (n)
			: "cc", "memory");
	return v;
}
f010592f:	89 f8                	mov    %edi,%eax
f0105931:	5b                   	pop    %ebx
f0105932:	5e                   	pop    %esi
f0105933:	5f                   	pop    %edi
f0105934:	5d                   	pop    %ebp
f0105935:	c3                   	ret    

f0105936 <memmove>:

void *
memmove(void *dst, const void *src, size_t n)
{
f0105936:	f3 0f 1e fb          	endbr32 
f010593a:	55                   	push   %ebp
f010593b:	89 e5                	mov    %esp,%ebp
f010593d:	57                   	push   %edi
f010593e:	56                   	push   %esi
f010593f:	8b 45 08             	mov    0x8(%ebp),%eax
f0105942:	8b 75 0c             	mov    0xc(%ebp),%esi
f0105945:	8b 4d 10             	mov    0x10(%ebp),%ecx
	const char *s;
	char *d;

	s = src;
	d = dst;
	if (s < d && s + n > d) {
f0105948:	39 c6                	cmp    %eax,%esi
f010594a:	73 32                	jae    f010597e <memmove+0x48>
f010594c:	8d 14 0e             	lea    (%esi,%ecx,1),%edx
f010594f:	39 c2                	cmp    %eax,%edx
f0105951:	76 2b                	jbe    f010597e <memmove+0x48>
		s += n;
		d += n;
f0105953:	8d 3c 08             	lea    (%eax,%ecx,1),%edi
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
f0105956:	89 fe                	mov    %edi,%esi
f0105958:	09 ce                	or     %ecx,%esi
f010595a:	09 d6                	or     %edx,%esi
f010595c:	f7 c6 03 00 00 00    	test   $0x3,%esi
f0105962:	75 0e                	jne    f0105972 <memmove+0x3c>
			asm volatile("std; rep movsl\n"
				:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
f0105964:	83 ef 04             	sub    $0x4,%edi
f0105967:	8d 72 fc             	lea    -0x4(%edx),%esi
f010596a:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("std; rep movsl\n"
f010596d:	fd                   	std    
f010596e:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
f0105970:	eb 09                	jmp    f010597b <memmove+0x45>
		else
			asm volatile("std; rep movsb\n"
				:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
f0105972:	83 ef 01             	sub    $0x1,%edi
f0105975:	8d 72 ff             	lea    -0x1(%edx),%esi
			asm volatile("std; rep movsb\n"
f0105978:	fd                   	std    
f0105979:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
		// Some versions of GCC rely on DF being clear
		asm volatile("cld" ::: "cc");
f010597b:	fc                   	cld    
f010597c:	eb 1a                	jmp    f0105998 <memmove+0x62>
	} else {
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
f010597e:	89 c2                	mov    %eax,%edx
f0105980:	09 ca                	or     %ecx,%edx
f0105982:	09 f2                	or     %esi,%edx
f0105984:	f6 c2 03             	test   $0x3,%dl
f0105987:	75 0a                	jne    f0105993 <memmove+0x5d>
			asm volatile("cld; rep movsl\n"
				:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
f0105989:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("cld; rep movsl\n"
f010598c:	89 c7                	mov    %eax,%edi
f010598e:	fc                   	cld    
f010598f:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
f0105991:	eb 05                	jmp    f0105998 <memmove+0x62>
		else
			asm volatile("cld; rep movsb\n"
f0105993:	89 c7                	mov    %eax,%edi
f0105995:	fc                   	cld    
f0105996:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
				:: "D" (d), "S" (s), "c" (n) : "cc", "memory");
	}
	return dst;
}
f0105998:	5e                   	pop    %esi
f0105999:	5f                   	pop    %edi
f010599a:	5d                   	pop    %ebp
f010599b:	c3                   	ret    

f010599c <memcpy>:
}
#endif

void *
memcpy(void *dst, const void *src, size_t n)
{
f010599c:	f3 0f 1e fb          	endbr32 
f01059a0:	55                   	push   %ebp
f01059a1:	89 e5                	mov    %esp,%ebp
f01059a3:	83 ec 0c             	sub    $0xc,%esp
	return memmove(dst, src, n);
f01059a6:	ff 75 10             	pushl  0x10(%ebp)
f01059a9:	ff 75 0c             	pushl  0xc(%ebp)
f01059ac:	ff 75 08             	pushl  0x8(%ebp)
f01059af:	e8 82 ff ff ff       	call   f0105936 <memmove>
}
f01059b4:	c9                   	leave  
f01059b5:	c3                   	ret    

f01059b6 <memcmp>:

int
memcmp(const void *v1, const void *v2, size_t n)
{
f01059b6:	f3 0f 1e fb          	endbr32 
f01059ba:	55                   	push   %ebp
f01059bb:	89 e5                	mov    %esp,%ebp
f01059bd:	56                   	push   %esi
f01059be:	53                   	push   %ebx
f01059bf:	8b 45 08             	mov    0x8(%ebp),%eax
f01059c2:	8b 55 0c             	mov    0xc(%ebp),%edx
f01059c5:	89 c6                	mov    %eax,%esi
f01059c7:	03 75 10             	add    0x10(%ebp),%esi
	const uint8_t *s1 = (const uint8_t *) v1;
	const uint8_t *s2 = (const uint8_t *) v2;

	while (n-- > 0) {
f01059ca:	39 f0                	cmp    %esi,%eax
f01059cc:	74 1c                	je     f01059ea <memcmp+0x34>
		if (*s1 != *s2)
f01059ce:	0f b6 08             	movzbl (%eax),%ecx
f01059d1:	0f b6 1a             	movzbl (%edx),%ebx
f01059d4:	38 d9                	cmp    %bl,%cl
f01059d6:	75 08                	jne    f01059e0 <memcmp+0x2a>
			return (int) *s1 - (int) *s2;
		s1++, s2++;
f01059d8:	83 c0 01             	add    $0x1,%eax
f01059db:	83 c2 01             	add    $0x1,%edx
f01059de:	eb ea                	jmp    f01059ca <memcmp+0x14>
			return (int) *s1 - (int) *s2;
f01059e0:	0f b6 c1             	movzbl %cl,%eax
f01059e3:	0f b6 db             	movzbl %bl,%ebx
f01059e6:	29 d8                	sub    %ebx,%eax
f01059e8:	eb 05                	jmp    f01059ef <memcmp+0x39>
	}

	return 0;
f01059ea:	b8 00 00 00 00       	mov    $0x0,%eax
}
f01059ef:	5b                   	pop    %ebx
f01059f0:	5e                   	pop    %esi
f01059f1:	5d                   	pop    %ebp
f01059f2:	c3                   	ret    

f01059f3 <memfind>:

void *
memfind(const void *s, int c, size_t n)
{
f01059f3:	f3 0f 1e fb          	endbr32 
f01059f7:	55                   	push   %ebp
f01059f8:	89 e5                	mov    %esp,%ebp
f01059fa:	8b 45 08             	mov    0x8(%ebp),%eax
f01059fd:	8b 4d 0c             	mov    0xc(%ebp),%ecx
	const void *ends = (const char *) s + n;
f0105a00:	89 c2                	mov    %eax,%edx
f0105a02:	03 55 10             	add    0x10(%ebp),%edx
	for (; s < ends; s++)
f0105a05:	39 d0                	cmp    %edx,%eax
f0105a07:	73 09                	jae    f0105a12 <memfind+0x1f>
		if (*(const unsigned char *) s == (unsigned char) c)
f0105a09:	38 08                	cmp    %cl,(%eax)
f0105a0b:	74 05                	je     f0105a12 <memfind+0x1f>
	for (; s < ends; s++)
f0105a0d:	83 c0 01             	add    $0x1,%eax
f0105a10:	eb f3                	jmp    f0105a05 <memfind+0x12>
			break;
	return (void *) s;
}
f0105a12:	5d                   	pop    %ebp
f0105a13:	c3                   	ret    

f0105a14 <strtol>:

long
strtol(const char *s, char **endptr, int base)
{
f0105a14:	f3 0f 1e fb          	endbr32 
f0105a18:	55                   	push   %ebp
f0105a19:	89 e5                	mov    %esp,%ebp
f0105a1b:	57                   	push   %edi
f0105a1c:	56                   	push   %esi
f0105a1d:	53                   	push   %ebx
f0105a1e:	8b 4d 08             	mov    0x8(%ebp),%ecx
f0105a21:	8b 5d 10             	mov    0x10(%ebp),%ebx
	int neg = 0;
	long val = 0;

	// gobble initial whitespace
	while (*s == ' ' || *s == '\t')
f0105a24:	eb 03                	jmp    f0105a29 <strtol+0x15>
		s++;
f0105a26:	83 c1 01             	add    $0x1,%ecx
	while (*s == ' ' || *s == '\t')
f0105a29:	0f b6 01             	movzbl (%ecx),%eax
f0105a2c:	3c 20                	cmp    $0x20,%al
f0105a2e:	74 f6                	je     f0105a26 <strtol+0x12>
f0105a30:	3c 09                	cmp    $0x9,%al
f0105a32:	74 f2                	je     f0105a26 <strtol+0x12>

	// plus/minus sign
	if (*s == '+')
f0105a34:	3c 2b                	cmp    $0x2b,%al
f0105a36:	74 2a                	je     f0105a62 <strtol+0x4e>
	int neg = 0;
f0105a38:	bf 00 00 00 00       	mov    $0x0,%edi
		s++;
	else if (*s == '-')
f0105a3d:	3c 2d                	cmp    $0x2d,%al
f0105a3f:	74 2b                	je     f0105a6c <strtol+0x58>
		s++, neg = 1;

	// hex or octal base prefix
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
f0105a41:	f7 c3 ef ff ff ff    	test   $0xffffffef,%ebx
f0105a47:	75 0f                	jne    f0105a58 <strtol+0x44>
f0105a49:	80 39 30             	cmpb   $0x30,(%ecx)
f0105a4c:	74 28                	je     f0105a76 <strtol+0x62>
		s += 2, base = 16;
	else if (base == 0 && s[0] == '0')
		s++, base = 8;
	else if (base == 0)
		base = 10;
f0105a4e:	85 db                	test   %ebx,%ebx
f0105a50:	b8 0a 00 00 00       	mov    $0xa,%eax
f0105a55:	0f 44 d8             	cmove  %eax,%ebx
f0105a58:	b8 00 00 00 00       	mov    $0x0,%eax
f0105a5d:	89 5d 10             	mov    %ebx,0x10(%ebp)
f0105a60:	eb 46                	jmp    f0105aa8 <strtol+0x94>
		s++;
f0105a62:	83 c1 01             	add    $0x1,%ecx
	int neg = 0;
f0105a65:	bf 00 00 00 00       	mov    $0x0,%edi
f0105a6a:	eb d5                	jmp    f0105a41 <strtol+0x2d>
		s++, neg = 1;
f0105a6c:	83 c1 01             	add    $0x1,%ecx
f0105a6f:	bf 01 00 00 00       	mov    $0x1,%edi
f0105a74:	eb cb                	jmp    f0105a41 <strtol+0x2d>
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
f0105a76:	80 79 01 78          	cmpb   $0x78,0x1(%ecx)
f0105a7a:	74 0e                	je     f0105a8a <strtol+0x76>
	else if (base == 0 && s[0] == '0')
f0105a7c:	85 db                	test   %ebx,%ebx
f0105a7e:	75 d8                	jne    f0105a58 <strtol+0x44>
		s++, base = 8;
f0105a80:	83 c1 01             	add    $0x1,%ecx
f0105a83:	bb 08 00 00 00       	mov    $0x8,%ebx
f0105a88:	eb ce                	jmp    f0105a58 <strtol+0x44>
		s += 2, base = 16;
f0105a8a:	83 c1 02             	add    $0x2,%ecx
f0105a8d:	bb 10 00 00 00       	mov    $0x10,%ebx
f0105a92:	eb c4                	jmp    f0105a58 <strtol+0x44>
	// digits
	while (1) {
		int dig;

		if (*s >= '0' && *s <= '9')
			dig = *s - '0';
f0105a94:	0f be d2             	movsbl %dl,%edx
f0105a97:	83 ea 30             	sub    $0x30,%edx
			dig = *s - 'a' + 10;
		else if (*s >= 'A' && *s <= 'Z')
			dig = *s - 'A' + 10;
		else
			break;
		if (dig >= base)
f0105a9a:	3b 55 10             	cmp    0x10(%ebp),%edx
f0105a9d:	7d 3a                	jge    f0105ad9 <strtol+0xc5>
			break;
		s++, val = (val * base) + dig;
f0105a9f:	83 c1 01             	add    $0x1,%ecx
f0105aa2:	0f af 45 10          	imul   0x10(%ebp),%eax
f0105aa6:	01 d0                	add    %edx,%eax
		if (*s >= '0' && *s <= '9')
f0105aa8:	0f b6 11             	movzbl (%ecx),%edx
f0105aab:	8d 72 d0             	lea    -0x30(%edx),%esi
f0105aae:	89 f3                	mov    %esi,%ebx
f0105ab0:	80 fb 09             	cmp    $0x9,%bl
f0105ab3:	76 df                	jbe    f0105a94 <strtol+0x80>
		else if (*s >= 'a' && *s <= 'z')
f0105ab5:	8d 72 9f             	lea    -0x61(%edx),%esi
f0105ab8:	89 f3                	mov    %esi,%ebx
f0105aba:	80 fb 19             	cmp    $0x19,%bl
f0105abd:	77 08                	ja     f0105ac7 <strtol+0xb3>
			dig = *s - 'a' + 10;
f0105abf:	0f be d2             	movsbl %dl,%edx
f0105ac2:	83 ea 57             	sub    $0x57,%edx
f0105ac5:	eb d3                	jmp    f0105a9a <strtol+0x86>
		else if (*s >= 'A' && *s <= 'Z')
f0105ac7:	8d 72 bf             	lea    -0x41(%edx),%esi
f0105aca:	89 f3                	mov    %esi,%ebx
f0105acc:	80 fb 19             	cmp    $0x19,%bl
f0105acf:	77 08                	ja     f0105ad9 <strtol+0xc5>
			dig = *s - 'A' + 10;
f0105ad1:	0f be d2             	movsbl %dl,%edx
f0105ad4:	83 ea 37             	sub    $0x37,%edx
f0105ad7:	eb c1                	jmp    f0105a9a <strtol+0x86>
		// we don't properly detect overflow!
	}

	if (endptr)
f0105ad9:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
f0105add:	74 05                	je     f0105ae4 <strtol+0xd0>
		*endptr = (char *) s;
f0105adf:	8b 75 0c             	mov    0xc(%ebp),%esi
f0105ae2:	89 0e                	mov    %ecx,(%esi)
	return (neg ? -val : val);
f0105ae4:	89 c2                	mov    %eax,%edx
f0105ae6:	f7 da                	neg    %edx
f0105ae8:	85 ff                	test   %edi,%edi
f0105aea:	0f 45 c2             	cmovne %edx,%eax
}
f0105aed:	5b                   	pop    %ebx
f0105aee:	5e                   	pop    %esi
f0105aef:	5f                   	pop    %edi
f0105af0:	5d                   	pop    %ebp
f0105af1:	c3                   	ret    
f0105af2:	66 90                	xchg   %ax,%ax

f0105af4 <mpentry_start>:
.set PROT_MODE_DSEG, 0x10	# kernel data segment selector

.code16           
.globl mpentry_start
mpentry_start:
	cli            
f0105af4:	fa                   	cli    

	xorw    %ax, %ax
f0105af5:	31 c0                	xor    %eax,%eax
	movw    %ax, %ds
f0105af7:	8e d8                	mov    %eax,%ds
	movw    %ax, %es
f0105af9:	8e c0                	mov    %eax,%es
	movw    %ax, %ss
f0105afb:	8e d0                	mov    %eax,%ss

	lgdt    MPBOOTPHYS(gdtdesc)
f0105afd:	0f 01 16             	lgdtl  (%esi)
f0105b00:	74 70                	je     f0105b72 <mpsearch1+0x3>
	movl    %cr0, %eax
f0105b02:	0f 20 c0             	mov    %cr0,%eax
	orl     $CR0_PE, %eax
f0105b05:	66 83 c8 01          	or     $0x1,%ax
	movl    %eax, %cr0
f0105b09:	0f 22 c0             	mov    %eax,%cr0

	ljmpl   $(PROT_MODE_CSEG), $(MPBOOTPHYS(start32))
f0105b0c:	66 ea 20 70 00 00    	ljmpw  $0x0,$0x7020
f0105b12:	08 00                	or     %al,(%eax)

f0105b14 <start32>:

.code32
start32:
	movw    $(PROT_MODE_DSEG), %ax
f0105b14:	66 b8 10 00          	mov    $0x10,%ax
	movw    %ax, %ds
f0105b18:	8e d8                	mov    %eax,%ds
	movw    %ax, %es
f0105b1a:	8e c0                	mov    %eax,%es
	movw    %ax, %ss
f0105b1c:	8e d0                	mov    %eax,%ss
	movw    $0, %ax
f0105b1e:	66 b8 00 00          	mov    $0x0,%ax
	movw    %ax, %fs
f0105b22:	8e e0                	mov    %eax,%fs
	movw    %ax, %gs
f0105b24:	8e e8                	mov    %eax,%gs

	# Set up initial page table. We cannot use kern_pgdir yet because
	# we are still running at a low EIP.
	movl    $(RELOC(entry_pgdir)), %eax
f0105b26:	b8 00 10 12 00       	mov    $0x121000,%eax
	movl    %eax, %cr3
f0105b2b:	0f 22 d8             	mov    %eax,%cr3
	# Turn on paging.
	movl    %cr0, %eax
f0105b2e:	0f 20 c0             	mov    %cr0,%eax
	orl     $(CR0_PE|CR0_PG|CR0_WP), %eax
f0105b31:	0d 01 00 01 80       	or     $0x80010001,%eax
	movl    %eax, %cr0
f0105b36:	0f 22 c0             	mov    %eax,%cr0

	# Switch to the per-cpu stack allocated in boot_aps()
	movl    mpentry_kstack, %esp
f0105b39:	8b 25 84 7e 21 f0    	mov    0xf0217e84,%esp
	movl    $0x0, %ebp       # nuke frame pointer
f0105b3f:	bd 00 00 00 00       	mov    $0x0,%ebp

	# Call mp_main().  (Exercise for the reader: why the indirect call?)
	movl    $mp_main, %eax
f0105b44:	b8 bd 01 10 f0       	mov    $0xf01001bd,%eax
	call    *%eax
f0105b49:	ff d0                	call   *%eax

f0105b4b <spin>:

	# If mp_main returns (it shouldn't), loop.
spin:
	jmp     spin
f0105b4b:	eb fe                	jmp    f0105b4b <spin>
f0105b4d:	8d 76 00             	lea    0x0(%esi),%esi

f0105b50 <gdt>:
	...
f0105b58:	ff                   	(bad)  
f0105b59:	ff 00                	incl   (%eax)
f0105b5b:	00 00                	add    %al,(%eax)
f0105b5d:	9a cf 00 ff ff 00 00 	lcall  $0x0,$0xffff00cf
f0105b64:	00                   	.byte 0x0
f0105b65:	92                   	xchg   %eax,%edx
f0105b66:	cf                   	iret   
	...

f0105b68 <gdtdesc>:
f0105b68:	17                   	pop    %ss
f0105b69:	00 5c 70 00          	add    %bl,0x0(%eax,%esi,2)
	...

f0105b6e <mpentry_end>:
	.word   0x17				# sizeof(gdt) - 1
	.long   MPBOOTPHYS(gdt)			# address gdt

.globl mpentry_end
mpentry_end:
	nop
f0105b6e:	90                   	nop

f0105b6f <mpsearch1>:
}

// Look for an MP structure in the len bytes at physical address addr.
static struct mp *
mpsearch1(physaddr_t a, int len)
{
f0105b6f:	55                   	push   %ebp
f0105b70:	89 e5                	mov    %esp,%ebp
f0105b72:	57                   	push   %edi
f0105b73:	56                   	push   %esi
f0105b74:	53                   	push   %ebx
f0105b75:	83 ec 0c             	sub    $0xc,%esp
f0105b78:	89 c7                	mov    %eax,%edi
	if (PGNUM(pa) >= npages)
f0105b7a:	a1 88 7e 21 f0       	mov    0xf0217e88,%eax
f0105b7f:	89 f9                	mov    %edi,%ecx
f0105b81:	c1 e9 0c             	shr    $0xc,%ecx
f0105b84:	39 c1                	cmp    %eax,%ecx
f0105b86:	73 19                	jae    f0105ba1 <mpsearch1+0x32>
	return (void *)(pa + KERNBASE);
f0105b88:	8d 9f 00 00 00 f0    	lea    -0x10000000(%edi),%ebx
	struct mp *mp = KADDR(a), *end = KADDR(a + len);
f0105b8e:	01 d7                	add    %edx,%edi
	if (PGNUM(pa) >= npages)
f0105b90:	89 fa                	mov    %edi,%edx
f0105b92:	c1 ea 0c             	shr    $0xc,%edx
f0105b95:	39 c2                	cmp    %eax,%edx
f0105b97:	73 1a                	jae    f0105bb3 <mpsearch1+0x44>
	return (void *)(pa + KERNBASE);
f0105b99:	81 ef 00 00 00 10    	sub    $0x10000000,%edi

	for (; mp < end; mp++)
f0105b9f:	eb 27                	jmp    f0105bc8 <mpsearch1+0x59>
		_panic(file, line, "KADDR called with invalid pa %08lx", pa);
f0105ba1:	57                   	push   %edi
f0105ba2:	68 a4 65 10 f0       	push   $0xf01065a4
f0105ba7:	6a 57                	push   $0x57
f0105ba9:	68 1d 81 10 f0       	push   $0xf010811d
f0105bae:	e8 8d a4 ff ff       	call   f0100040 <_panic>
f0105bb3:	57                   	push   %edi
f0105bb4:	68 a4 65 10 f0       	push   $0xf01065a4
f0105bb9:	6a 57                	push   $0x57
f0105bbb:	68 1d 81 10 f0       	push   $0xf010811d
f0105bc0:	e8 7b a4 ff ff       	call   f0100040 <_panic>
f0105bc5:	83 c3 10             	add    $0x10,%ebx
f0105bc8:	39 fb                	cmp    %edi,%ebx
f0105bca:	73 30                	jae    f0105bfc <mpsearch1+0x8d>
f0105bcc:	89 de                	mov    %ebx,%esi
		if (memcmp(mp->signature, "_MP_", 4) == 0 &&
f0105bce:	83 ec 04             	sub    $0x4,%esp
f0105bd1:	6a 04                	push   $0x4
f0105bd3:	68 2d 81 10 f0       	push   $0xf010812d
f0105bd8:	53                   	push   %ebx
f0105bd9:	e8 d8 fd ff ff       	call   f01059b6 <memcmp>
f0105bde:	83 c4 10             	add    $0x10,%esp
f0105be1:	85 c0                	test   %eax,%eax
f0105be3:	75 e0                	jne    f0105bc5 <mpsearch1+0x56>
f0105be5:	89 da                	mov    %ebx,%edx
	for (i = 0; i < len; i++)
f0105be7:	83 c6 10             	add    $0x10,%esi
		sum += ((uint8_t *)addr)[i];
f0105bea:	0f b6 0a             	movzbl (%edx),%ecx
f0105bed:	01 c8                	add    %ecx,%eax
f0105bef:	83 c2 01             	add    $0x1,%edx
	for (i = 0; i < len; i++)
f0105bf2:	39 f2                	cmp    %esi,%edx
f0105bf4:	75 f4                	jne    f0105bea <mpsearch1+0x7b>
		if (memcmp(mp->signature, "_MP_", 4) == 0 &&
f0105bf6:	84 c0                	test   %al,%al
f0105bf8:	75 cb                	jne    f0105bc5 <mpsearch1+0x56>
f0105bfa:	eb 05                	jmp    f0105c01 <mpsearch1+0x92>
		    sum(mp, sizeof(*mp)) == 0)
			return mp;
	return NULL;
f0105bfc:	bb 00 00 00 00       	mov    $0x0,%ebx
}
f0105c01:	89 d8                	mov    %ebx,%eax
f0105c03:	8d 65 f4             	lea    -0xc(%ebp),%esp
f0105c06:	5b                   	pop    %ebx
f0105c07:	5e                   	pop    %esi
f0105c08:	5f                   	pop    %edi
f0105c09:	5d                   	pop    %ebp
f0105c0a:	c3                   	ret    

f0105c0b <mp_init>:
	return conf;
}

void
mp_init(void)
{
f0105c0b:	f3 0f 1e fb          	endbr32 
f0105c0f:	55                   	push   %ebp
f0105c10:	89 e5                	mov    %esp,%ebp
f0105c12:	57                   	push   %edi
f0105c13:	56                   	push   %esi
f0105c14:	53                   	push   %ebx
f0105c15:	83 ec 1c             	sub    $0x1c,%esp
	struct mpconf *conf;
	struct mpproc *proc;
	uint8_t *p;
	unsigned int i;

	bootcpu = &cpus[0];
f0105c18:	c7 05 c0 83 21 f0 20 	movl   $0xf0218020,0xf02183c0
f0105c1f:	80 21 f0 
	if (PGNUM(pa) >= npages)
f0105c22:	83 3d 88 7e 21 f0 00 	cmpl   $0x0,0xf0217e88
f0105c29:	0f 84 a3 00 00 00    	je     f0105cd2 <mp_init+0xc7>
	if ((p = *(uint16_t *) (bda + 0x0E))) {
f0105c2f:	0f b7 05 0e 04 00 f0 	movzwl 0xf000040e,%eax
f0105c36:	85 c0                	test   %eax,%eax
f0105c38:	0f 84 aa 00 00 00    	je     f0105ce8 <mp_init+0xdd>
		p <<= 4;	// Translate from segment to PA
f0105c3e:	c1 e0 04             	shl    $0x4,%eax
		if ((mp = mpsearch1(p, 1024)))
f0105c41:	ba 00 04 00 00       	mov    $0x400,%edx
f0105c46:	e8 24 ff ff ff       	call   f0105b6f <mpsearch1>
f0105c4b:	89 45 e4             	mov    %eax,-0x1c(%ebp)
f0105c4e:	85 c0                	test   %eax,%eax
f0105c50:	75 1a                	jne    f0105c6c <mp_init+0x61>
	return mpsearch1(0xF0000, 0x10000);
f0105c52:	ba 00 00 01 00       	mov    $0x10000,%edx
f0105c57:	b8 00 00 0f 00       	mov    $0xf0000,%eax
f0105c5c:	e8 0e ff ff ff       	call   f0105b6f <mpsearch1>
f0105c61:	89 45 e4             	mov    %eax,-0x1c(%ebp)
	if ((mp = mpsearch()) == 0)
f0105c64:	85 c0                	test   %eax,%eax
f0105c66:	0f 84 35 02 00 00    	je     f0105ea1 <mp_init+0x296>
	if (mp->physaddr == 0 || mp->type != 0) {
f0105c6c:	8b 45 e4             	mov    -0x1c(%ebp),%eax
f0105c6f:	8b 58 04             	mov    0x4(%eax),%ebx
f0105c72:	85 db                	test   %ebx,%ebx
f0105c74:	0f 84 97 00 00 00    	je     f0105d11 <mp_init+0x106>
f0105c7a:	80 78 0b 00          	cmpb   $0x0,0xb(%eax)
f0105c7e:	0f 85 8d 00 00 00    	jne    f0105d11 <mp_init+0x106>
f0105c84:	89 d8                	mov    %ebx,%eax
f0105c86:	c1 e8 0c             	shr    $0xc,%eax
f0105c89:	3b 05 88 7e 21 f0    	cmp    0xf0217e88,%eax
f0105c8f:	0f 83 91 00 00 00    	jae    f0105d26 <mp_init+0x11b>
	return (void *)(pa + KERNBASE);
f0105c95:	81 eb 00 00 00 10    	sub    $0x10000000,%ebx
f0105c9b:	89 de                	mov    %ebx,%esi
	if (memcmp(conf, "PCMP", 4) != 0) {
f0105c9d:	83 ec 04             	sub    $0x4,%esp
f0105ca0:	6a 04                	push   $0x4
f0105ca2:	68 32 81 10 f0       	push   $0xf0108132
f0105ca7:	53                   	push   %ebx
f0105ca8:	e8 09 fd ff ff       	call   f01059b6 <memcmp>
f0105cad:	83 c4 10             	add    $0x10,%esp
f0105cb0:	85 c0                	test   %eax,%eax
f0105cb2:	0f 85 83 00 00 00    	jne    f0105d3b <mp_init+0x130>
f0105cb8:	0f b7 7b 04          	movzwl 0x4(%ebx),%edi
f0105cbc:	01 df                	add    %ebx,%edi
	sum = 0;
f0105cbe:	89 c2                	mov    %eax,%edx
	for (i = 0; i < len; i++)
f0105cc0:	39 fb                	cmp    %edi,%ebx
f0105cc2:	0f 84 88 00 00 00    	je     f0105d50 <mp_init+0x145>
		sum += ((uint8_t *)addr)[i];
f0105cc8:	0f b6 0b             	movzbl (%ebx),%ecx
f0105ccb:	01 ca                	add    %ecx,%edx
f0105ccd:	83 c3 01             	add    $0x1,%ebx
f0105cd0:	eb ee                	jmp    f0105cc0 <mp_init+0xb5>
		_panic(file, line, "KADDR called with invalid pa %08lx", pa);
f0105cd2:	68 00 04 00 00       	push   $0x400
f0105cd7:	68 a4 65 10 f0       	push   $0xf01065a4
f0105cdc:	6a 6f                	push   $0x6f
f0105cde:	68 1d 81 10 f0       	push   $0xf010811d
f0105ce3:	e8 58 a3 ff ff       	call   f0100040 <_panic>
		p = *(uint16_t *) (bda + 0x13) * 1024;
f0105ce8:	0f b7 05 13 04 00 f0 	movzwl 0xf0000413,%eax
f0105cef:	c1 e0 0a             	shl    $0xa,%eax
		if ((mp = mpsearch1(p - 1024, 1024)))
f0105cf2:	2d 00 04 00 00       	sub    $0x400,%eax
f0105cf7:	ba 00 04 00 00       	mov    $0x400,%edx
f0105cfc:	e8 6e fe ff ff       	call   f0105b6f <mpsearch1>
f0105d01:	89 45 e4             	mov    %eax,-0x1c(%ebp)
f0105d04:	85 c0                	test   %eax,%eax
f0105d06:	0f 85 60 ff ff ff    	jne    f0105c6c <mp_init+0x61>
f0105d0c:	e9 41 ff ff ff       	jmp    f0105c52 <mp_init+0x47>
		cprintf("SMP: Default configurations not implemented\n");
f0105d11:	83 ec 0c             	sub    $0xc,%esp
f0105d14:	68 90 7f 10 f0       	push   $0xf0107f90
f0105d19:	e8 bf da ff ff       	call   f01037dd <cprintf>
		return NULL;
f0105d1e:	83 c4 10             	add    $0x10,%esp
f0105d21:	e9 7b 01 00 00       	jmp    f0105ea1 <mp_init+0x296>
f0105d26:	53                   	push   %ebx
f0105d27:	68 a4 65 10 f0       	push   $0xf01065a4
f0105d2c:	68 90 00 00 00       	push   $0x90
f0105d31:	68 1d 81 10 f0       	push   $0xf010811d
f0105d36:	e8 05 a3 ff ff       	call   f0100040 <_panic>
		cprintf("SMP: Incorrect MP configuration table signature\n");
f0105d3b:	83 ec 0c             	sub    $0xc,%esp
f0105d3e:	68 c0 7f 10 f0       	push   $0xf0107fc0
f0105d43:	e8 95 da ff ff       	call   f01037dd <cprintf>
		return NULL;
f0105d48:	83 c4 10             	add    $0x10,%esp
f0105d4b:	e9 51 01 00 00       	jmp    f0105ea1 <mp_init+0x296>
	if (sum(conf, conf->length) != 0) {
f0105d50:	84 d2                	test   %dl,%dl
f0105d52:	75 22                	jne    f0105d76 <mp_init+0x16b>
	if (conf->version != 1 && conf->version != 4) {
f0105d54:	0f b6 56 06          	movzbl 0x6(%esi),%edx
f0105d58:	80 fa 01             	cmp    $0x1,%dl
f0105d5b:	74 05                	je     f0105d62 <mp_init+0x157>
f0105d5d:	80 fa 04             	cmp    $0x4,%dl
f0105d60:	75 29                	jne    f0105d8b <mp_init+0x180>
f0105d62:	0f b7 4e 28          	movzwl 0x28(%esi),%ecx
f0105d66:	01 d9                	add    %ebx,%ecx
	for (i = 0; i < len; i++)
f0105d68:	39 d9                	cmp    %ebx,%ecx
f0105d6a:	74 38                	je     f0105da4 <mp_init+0x199>
		sum += ((uint8_t *)addr)[i];
f0105d6c:	0f b6 13             	movzbl (%ebx),%edx
f0105d6f:	01 d0                	add    %edx,%eax
f0105d71:	83 c3 01             	add    $0x1,%ebx
f0105d74:	eb f2                	jmp    f0105d68 <mp_init+0x15d>
		cprintf("SMP: Bad MP configuration checksum\n");
f0105d76:	83 ec 0c             	sub    $0xc,%esp
f0105d79:	68 f4 7f 10 f0       	push   $0xf0107ff4
f0105d7e:	e8 5a da ff ff       	call   f01037dd <cprintf>
		return NULL;
f0105d83:	83 c4 10             	add    $0x10,%esp
f0105d86:	e9 16 01 00 00       	jmp    f0105ea1 <mp_init+0x296>
		cprintf("SMP: Unsupported MP version %d\n", conf->version);
f0105d8b:	83 ec 08             	sub    $0x8,%esp
f0105d8e:	0f b6 d2             	movzbl %dl,%edx
f0105d91:	52                   	push   %edx
f0105d92:	68 18 80 10 f0       	push   $0xf0108018
f0105d97:	e8 41 da ff ff       	call   f01037dd <cprintf>
		return NULL;
f0105d9c:	83 c4 10             	add    $0x10,%esp
f0105d9f:	e9 fd 00 00 00       	jmp    f0105ea1 <mp_init+0x296>
	if ((sum((uint8_t *)conf + conf->length, conf->xlength) + conf->xchecksum) & 0xff) {
f0105da4:	02 46 2a             	add    0x2a(%esi),%al
f0105da7:	75 1c                	jne    f0105dc5 <mp_init+0x1ba>
	if ((conf = mpconfig(&mp)) == 0)
		return;
	ismp = 1;
f0105da9:	c7 05 00 80 21 f0 01 	movl   $0x1,0xf0218000
f0105db0:	00 00 00 
	lapicaddr = conf->lapicaddr;
f0105db3:	8b 46 24             	mov    0x24(%esi),%eax
f0105db6:	a3 00 90 25 f0       	mov    %eax,0xf0259000

	for (p = conf->entries, i = 0; i < conf->entry; i++) {
f0105dbb:	8d 7e 2c             	lea    0x2c(%esi),%edi
f0105dbe:	bb 00 00 00 00       	mov    $0x0,%ebx
f0105dc3:	eb 4d                	jmp    f0105e12 <mp_init+0x207>
		cprintf("SMP: Bad MP configuration extended checksum\n");
f0105dc5:	83 ec 0c             	sub    $0xc,%esp
f0105dc8:	68 38 80 10 f0       	push   $0xf0108038
f0105dcd:	e8 0b da ff ff       	call   f01037dd <cprintf>
		return NULL;
f0105dd2:	83 c4 10             	add    $0x10,%esp
f0105dd5:	e9 c7 00 00 00       	jmp    f0105ea1 <mp_init+0x296>
		switch (*p) {
		case MPPROC:
			proc = (struct mpproc *)p;
			if (proc->flags & MPPROC_BOOT)
f0105dda:	f6 47 03 02          	testb  $0x2,0x3(%edi)
f0105dde:	74 11                	je     f0105df1 <mp_init+0x1e6>
				bootcpu = &cpus[ncpu];
f0105de0:	6b 05 c4 83 21 f0 74 	imul   $0x74,0xf02183c4,%eax
f0105de7:	05 20 80 21 f0       	add    $0xf0218020,%eax
f0105dec:	a3 c0 83 21 f0       	mov    %eax,0xf02183c0
			if (ncpu < NCPU) {
f0105df1:	a1 c4 83 21 f0       	mov    0xf02183c4,%eax
f0105df6:	83 f8 07             	cmp    $0x7,%eax
f0105df9:	7f 33                	jg     f0105e2e <mp_init+0x223>
				cpus[ncpu].cpu_id = ncpu;
f0105dfb:	6b d0 74             	imul   $0x74,%eax,%edx
f0105dfe:	88 82 20 80 21 f0    	mov    %al,-0xfde7fe0(%edx)
				ncpu++;
f0105e04:	83 c0 01             	add    $0x1,%eax
f0105e07:	a3 c4 83 21 f0       	mov    %eax,0xf02183c4
			} else {
				cprintf("SMP: too many CPUs, CPU %d disabled\n",
					proc->apicid);
			}
			p += sizeof(struct mpproc);
f0105e0c:	83 c7 14             	add    $0x14,%edi
	for (p = conf->entries, i = 0; i < conf->entry; i++) {
f0105e0f:	83 c3 01             	add    $0x1,%ebx
f0105e12:	0f b7 46 22          	movzwl 0x22(%esi),%eax
f0105e16:	39 d8                	cmp    %ebx,%eax
f0105e18:	76 4f                	jbe    f0105e69 <mp_init+0x25e>
		switch (*p) {
f0105e1a:	0f b6 07             	movzbl (%edi),%eax
f0105e1d:	84 c0                	test   %al,%al
f0105e1f:	74 b9                	je     f0105dda <mp_init+0x1cf>
f0105e21:	8d 50 ff             	lea    -0x1(%eax),%edx
f0105e24:	80 fa 03             	cmp    $0x3,%dl
f0105e27:	77 1c                	ja     f0105e45 <mp_init+0x23a>
			continue;
		case MPBUS:
		case MPIOAPIC:
		case MPIOINTR:
		case MPLINTR:
			p += 8;
f0105e29:	83 c7 08             	add    $0x8,%edi
			continue;
f0105e2c:	eb e1                	jmp    f0105e0f <mp_init+0x204>
				cprintf("SMP: too many CPUs, CPU %d disabled\n",
f0105e2e:	83 ec 08             	sub    $0x8,%esp
f0105e31:	0f b6 47 01          	movzbl 0x1(%edi),%eax
f0105e35:	50                   	push   %eax
f0105e36:	68 68 80 10 f0       	push   $0xf0108068
f0105e3b:	e8 9d d9 ff ff       	call   f01037dd <cprintf>
f0105e40:	83 c4 10             	add    $0x10,%esp
f0105e43:	eb c7                	jmp    f0105e0c <mp_init+0x201>
		default:
			cprintf("mpinit: unknown config type %x\n", *p);
f0105e45:	83 ec 08             	sub    $0x8,%esp
		switch (*p) {
f0105e48:	0f b6 c0             	movzbl %al,%eax
			cprintf("mpinit: unknown config type %x\n", *p);
f0105e4b:	50                   	push   %eax
f0105e4c:	68 90 80 10 f0       	push   $0xf0108090
f0105e51:	e8 87 d9 ff ff       	call   f01037dd <cprintf>
			ismp = 0;
f0105e56:	c7 05 00 80 21 f0 00 	movl   $0x0,0xf0218000
f0105e5d:	00 00 00 
			i = conf->entry;
f0105e60:	0f b7 5e 22          	movzwl 0x22(%esi),%ebx
f0105e64:	83 c4 10             	add    $0x10,%esp
f0105e67:	eb a6                	jmp    f0105e0f <mp_init+0x204>
		}
	}

	bootcpu->cpu_status = CPU_STARTED;
f0105e69:	a1 c0 83 21 f0       	mov    0xf02183c0,%eax
f0105e6e:	c7 40 04 01 00 00 00 	movl   $0x1,0x4(%eax)
	if (!ismp) {
f0105e75:	83 3d 00 80 21 f0 00 	cmpl   $0x0,0xf0218000
f0105e7c:	74 2b                	je     f0105ea9 <mp_init+0x29e>
		ncpu = 1;
		lapicaddr = 0;
		cprintf("SMP: configuration not found, SMP disabled\n");
		return;
	}
	cprintf("SMP: CPU %d found %d CPU(s)\n", bootcpu->cpu_id,  ncpu);
f0105e7e:	83 ec 04             	sub    $0x4,%esp
f0105e81:	ff 35 c4 83 21 f0    	pushl  0xf02183c4
f0105e87:	0f b6 00             	movzbl (%eax),%eax
f0105e8a:	50                   	push   %eax
f0105e8b:	68 37 81 10 f0       	push   $0xf0108137
f0105e90:	e8 48 d9 ff ff       	call   f01037dd <cprintf>

	if (mp->imcrp) {
f0105e95:	83 c4 10             	add    $0x10,%esp
f0105e98:	8b 45 e4             	mov    -0x1c(%ebp),%eax
f0105e9b:	80 78 0c 00          	cmpb   $0x0,0xc(%eax)
f0105e9f:	75 2e                	jne    f0105ecf <mp_init+0x2c4>
		// switch to getting interrupts from the LAPIC.
		cprintf("SMP: Setting IMCR to switch from PIC mode to symmetric I/O mode\n");
		outb(0x22, 0x70);   // Select IMCR
		outb(0x23, inb(0x23) | 1);  // Mask external interrupts.
	}
}
f0105ea1:	8d 65 f4             	lea    -0xc(%ebp),%esp
f0105ea4:	5b                   	pop    %ebx
f0105ea5:	5e                   	pop    %esi
f0105ea6:	5f                   	pop    %edi
f0105ea7:	5d                   	pop    %ebp
f0105ea8:	c3                   	ret    
		ncpu = 1;
f0105ea9:	c7 05 c4 83 21 f0 01 	movl   $0x1,0xf02183c4
f0105eb0:	00 00 00 
		lapicaddr = 0;
f0105eb3:	c7 05 00 90 25 f0 00 	movl   $0x0,0xf0259000
f0105eba:	00 00 00 
		cprintf("SMP: configuration not found, SMP disabled\n");
f0105ebd:	83 ec 0c             	sub    $0xc,%esp
f0105ec0:	68 b0 80 10 f0       	push   $0xf01080b0
f0105ec5:	e8 13 d9 ff ff       	call   f01037dd <cprintf>
		return;
f0105eca:	83 c4 10             	add    $0x10,%esp
f0105ecd:	eb d2                	jmp    f0105ea1 <mp_init+0x296>
		cprintf("SMP: Setting IMCR to switch from PIC mode to symmetric I/O mode\n");
f0105ecf:	83 ec 0c             	sub    $0xc,%esp
f0105ed2:	68 dc 80 10 f0       	push   $0xf01080dc
f0105ed7:	e8 01 d9 ff ff       	call   f01037dd <cprintf>
	asm volatile("outb %0,%w1" : : "a" (data), "d" (port));
f0105edc:	b8 70 00 00 00       	mov    $0x70,%eax
f0105ee1:	ba 22 00 00 00       	mov    $0x22,%edx
f0105ee6:	ee                   	out    %al,(%dx)
	asm volatile("inb %w1,%0" : "=a" (data) : "d" (port));
f0105ee7:	ba 23 00 00 00       	mov    $0x23,%edx
f0105eec:	ec                   	in     (%dx),%al
		outb(0x23, inb(0x23) | 1);  // Mask external interrupts.
f0105eed:	83 c8 01             	or     $0x1,%eax
	asm volatile("outb %0,%w1" : : "a" (data), "d" (port));
f0105ef0:	ee                   	out    %al,(%dx)
}
f0105ef1:	83 c4 10             	add    $0x10,%esp
f0105ef4:	eb ab                	jmp    f0105ea1 <mp_init+0x296>

f0105ef6 <lapicw>:
volatile uint32_t *lapic;

static void
lapicw(int index, int value)
{
	lapic[index] = value;
f0105ef6:	8b 0d 04 90 25 f0    	mov    0xf0259004,%ecx
f0105efc:	8d 04 81             	lea    (%ecx,%eax,4),%eax
f0105eff:	89 10                	mov    %edx,(%eax)
	lapic[ID];  // wait for write to finish, by reading
f0105f01:	a1 04 90 25 f0       	mov    0xf0259004,%eax
f0105f06:	8b 40 20             	mov    0x20(%eax),%eax
}
f0105f09:	c3                   	ret    

f0105f0a <cpunum>:
	lapicw(TPR, 0);
}

int
cpunum(void)
{
f0105f0a:	f3 0f 1e fb          	endbr32 
	if (lapic)
f0105f0e:	8b 15 04 90 25 f0    	mov    0xf0259004,%edx
		return lapic[ID] >> 24;
	return 0;
f0105f14:	b8 00 00 00 00       	mov    $0x0,%eax
	if (lapic)
f0105f19:	85 d2                	test   %edx,%edx
f0105f1b:	74 06                	je     f0105f23 <cpunum+0x19>
		return lapic[ID] >> 24;
f0105f1d:	8b 42 20             	mov    0x20(%edx),%eax
f0105f20:	c1 e8 18             	shr    $0x18,%eax
}
f0105f23:	c3                   	ret    

f0105f24 <lapic_init>:
{
f0105f24:	f3 0f 1e fb          	endbr32 
	if (!lapicaddr)
f0105f28:	a1 00 90 25 f0       	mov    0xf0259000,%eax
f0105f2d:	85 c0                	test   %eax,%eax
f0105f2f:	75 01                	jne    f0105f32 <lapic_init+0xe>
f0105f31:	c3                   	ret    
{
f0105f32:	55                   	push   %ebp
f0105f33:	89 e5                	mov    %esp,%ebp
f0105f35:	83 ec 10             	sub    $0x10,%esp
	lapic = mmio_map_region(lapicaddr, 4096);
f0105f38:	68 00 10 00 00       	push   $0x1000
f0105f3d:	50                   	push   %eax
f0105f3e:	e8 9d b2 ff ff       	call   f01011e0 <mmio_map_region>
f0105f43:	a3 04 90 25 f0       	mov    %eax,0xf0259004
	lapicw(SVR, ENABLE | (IRQ_OFFSET + IRQ_SPURIOUS));
f0105f48:	ba 27 01 00 00       	mov    $0x127,%edx
f0105f4d:	b8 3c 00 00 00       	mov    $0x3c,%eax
f0105f52:	e8 9f ff ff ff       	call   f0105ef6 <lapicw>
	lapicw(TDCR, X1);
f0105f57:	ba 0b 00 00 00       	mov    $0xb,%edx
f0105f5c:	b8 f8 00 00 00       	mov    $0xf8,%eax
f0105f61:	e8 90 ff ff ff       	call   f0105ef6 <lapicw>
	lapicw(TIMER, PERIODIC | (IRQ_OFFSET + IRQ_TIMER));
f0105f66:	ba 20 00 02 00       	mov    $0x20020,%edx
f0105f6b:	b8 c8 00 00 00       	mov    $0xc8,%eax
f0105f70:	e8 81 ff ff ff       	call   f0105ef6 <lapicw>
	lapicw(TICR, 10000000); 
f0105f75:	ba 80 96 98 00       	mov    $0x989680,%edx
f0105f7a:	b8 e0 00 00 00       	mov    $0xe0,%eax
f0105f7f:	e8 72 ff ff ff       	call   f0105ef6 <lapicw>
	if (thiscpu != bootcpu)
f0105f84:	e8 81 ff ff ff       	call   f0105f0a <cpunum>
f0105f89:	6b c0 74             	imul   $0x74,%eax,%eax
f0105f8c:	05 20 80 21 f0       	add    $0xf0218020,%eax
f0105f91:	83 c4 10             	add    $0x10,%esp
f0105f94:	39 05 c0 83 21 f0    	cmp    %eax,0xf02183c0
f0105f9a:	74 0f                	je     f0105fab <lapic_init+0x87>
		lapicw(LINT0, MASKED);
f0105f9c:	ba 00 00 01 00       	mov    $0x10000,%edx
f0105fa1:	b8 d4 00 00 00       	mov    $0xd4,%eax
f0105fa6:	e8 4b ff ff ff       	call   f0105ef6 <lapicw>
	lapicw(LINT1, MASKED);
f0105fab:	ba 00 00 01 00       	mov    $0x10000,%edx
f0105fb0:	b8 d8 00 00 00       	mov    $0xd8,%eax
f0105fb5:	e8 3c ff ff ff       	call   f0105ef6 <lapicw>
	if (((lapic[VER]>>16) & 0xFF) >= 4)
f0105fba:	a1 04 90 25 f0       	mov    0xf0259004,%eax
f0105fbf:	8b 40 30             	mov    0x30(%eax),%eax
f0105fc2:	c1 e8 10             	shr    $0x10,%eax
f0105fc5:	a8 fc                	test   $0xfc,%al
f0105fc7:	75 7c                	jne    f0106045 <lapic_init+0x121>
	lapicw(ERROR, IRQ_OFFSET + IRQ_ERROR);
f0105fc9:	ba 33 00 00 00       	mov    $0x33,%edx
f0105fce:	b8 dc 00 00 00       	mov    $0xdc,%eax
f0105fd3:	e8 1e ff ff ff       	call   f0105ef6 <lapicw>
	lapicw(ESR, 0);
f0105fd8:	ba 00 00 00 00       	mov    $0x0,%edx
f0105fdd:	b8 a0 00 00 00       	mov    $0xa0,%eax
f0105fe2:	e8 0f ff ff ff       	call   f0105ef6 <lapicw>
	lapicw(ESR, 0);
f0105fe7:	ba 00 00 00 00       	mov    $0x0,%edx
f0105fec:	b8 a0 00 00 00       	mov    $0xa0,%eax
f0105ff1:	e8 00 ff ff ff       	call   f0105ef6 <lapicw>
	lapicw(EOI, 0);
f0105ff6:	ba 00 00 00 00       	mov    $0x0,%edx
f0105ffb:	b8 2c 00 00 00       	mov    $0x2c,%eax
f0106000:	e8 f1 fe ff ff       	call   f0105ef6 <lapicw>
	lapicw(ICRHI, 0);
f0106005:	ba 00 00 00 00       	mov    $0x0,%edx
f010600a:	b8 c4 00 00 00       	mov    $0xc4,%eax
f010600f:	e8 e2 fe ff ff       	call   f0105ef6 <lapicw>
	lapicw(ICRLO, BCAST | INIT | LEVEL);
f0106014:	ba 00 85 08 00       	mov    $0x88500,%edx
f0106019:	b8 c0 00 00 00       	mov    $0xc0,%eax
f010601e:	e8 d3 fe ff ff       	call   f0105ef6 <lapicw>
	while(lapic[ICRLO] & DELIVS)
f0106023:	8b 15 04 90 25 f0    	mov    0xf0259004,%edx
f0106029:	8b 82 00 03 00 00    	mov    0x300(%edx),%eax
f010602f:	f6 c4 10             	test   $0x10,%ah
f0106032:	75 f5                	jne    f0106029 <lapic_init+0x105>
	lapicw(TPR, 0);
f0106034:	ba 00 00 00 00       	mov    $0x0,%edx
f0106039:	b8 20 00 00 00       	mov    $0x20,%eax
f010603e:	e8 b3 fe ff ff       	call   f0105ef6 <lapicw>
}
f0106043:	c9                   	leave  
f0106044:	c3                   	ret    
		lapicw(PCINT, MASKED);
f0106045:	ba 00 00 01 00       	mov    $0x10000,%edx
f010604a:	b8 d0 00 00 00       	mov    $0xd0,%eax
f010604f:	e8 a2 fe ff ff       	call   f0105ef6 <lapicw>
f0106054:	e9 70 ff ff ff       	jmp    f0105fc9 <lapic_init+0xa5>

f0106059 <lapic_eoi>:

// Acknowledge interrupt.
void
lapic_eoi(void)
{
f0106059:	f3 0f 1e fb          	endbr32 
	if (lapic)
f010605d:	83 3d 04 90 25 f0 00 	cmpl   $0x0,0xf0259004
f0106064:	74 17                	je     f010607d <lapic_eoi+0x24>
{
f0106066:	55                   	push   %ebp
f0106067:	89 e5                	mov    %esp,%ebp
f0106069:	83 ec 08             	sub    $0x8,%esp
		lapicw(EOI, 0);
f010606c:	ba 00 00 00 00       	mov    $0x0,%edx
f0106071:	b8 2c 00 00 00       	mov    $0x2c,%eax
f0106076:	e8 7b fe ff ff       	call   f0105ef6 <lapicw>
}
f010607b:	c9                   	leave  
f010607c:	c3                   	ret    
f010607d:	c3                   	ret    

f010607e <lapic_startap>:

// Start additional processor running entry code at addr.
// See Appendix B of MultiProcessor Specification.
void
lapic_startap(uint8_t apicid, uint32_t addr)
{
f010607e:	f3 0f 1e fb          	endbr32 
f0106082:	55                   	push   %ebp
f0106083:	89 e5                	mov    %esp,%ebp
f0106085:	56                   	push   %esi
f0106086:	53                   	push   %ebx
f0106087:	8b 75 08             	mov    0x8(%ebp),%esi
f010608a:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	asm volatile("outb %0,%w1" : : "a" (data), "d" (port));
f010608d:	b8 0f 00 00 00       	mov    $0xf,%eax
f0106092:	ba 70 00 00 00       	mov    $0x70,%edx
f0106097:	ee                   	out    %al,(%dx)
f0106098:	b8 0a 00 00 00       	mov    $0xa,%eax
f010609d:	ba 71 00 00 00       	mov    $0x71,%edx
f01060a2:	ee                   	out    %al,(%dx)
	if (PGNUM(pa) >= npages)
f01060a3:	83 3d 88 7e 21 f0 00 	cmpl   $0x0,0xf0217e88
f01060aa:	74 7e                	je     f010612a <lapic_startap+0xac>
	// and the warm reset vector (DWORD based at 40:67) to point at
	// the AP startup code prior to the [universal startup algorithm]."
	outb(IO_RTC, 0xF);  // offset 0xF is shutdown code
	outb(IO_RTC+1, 0x0A);
	wrv = (uint16_t *)KADDR((0x40 << 4 | 0x67));  // Warm reset vector
	wrv[0] = 0;
f01060ac:	66 c7 05 67 04 00 f0 	movw   $0x0,0xf0000467
f01060b3:	00 00 
	wrv[1] = addr >> 4;
f01060b5:	89 d8                	mov    %ebx,%eax
f01060b7:	c1 e8 04             	shr    $0x4,%eax
f01060ba:	66 a3 69 04 00 f0    	mov    %ax,0xf0000469

	// "Universal startup algorithm."
	// Send INIT (level-triggered) interrupt to reset other CPU.
	lapicw(ICRHI, apicid << 24);
f01060c0:	c1 e6 18             	shl    $0x18,%esi
f01060c3:	89 f2                	mov    %esi,%edx
f01060c5:	b8 c4 00 00 00       	mov    $0xc4,%eax
f01060ca:	e8 27 fe ff ff       	call   f0105ef6 <lapicw>
	lapicw(ICRLO, INIT | LEVEL | ASSERT);
f01060cf:	ba 00 c5 00 00       	mov    $0xc500,%edx
f01060d4:	b8 c0 00 00 00       	mov    $0xc0,%eax
f01060d9:	e8 18 fe ff ff       	call   f0105ef6 <lapicw>
	microdelay(200);
	lapicw(ICRLO, INIT | LEVEL);
f01060de:	ba 00 85 00 00       	mov    $0x8500,%edx
f01060e3:	b8 c0 00 00 00       	mov    $0xc0,%eax
f01060e8:	e8 09 fe ff ff       	call   f0105ef6 <lapicw>
	// when it is in the halted state due to an INIT.  So the second
	// should be ignored, but it is part of the official Intel algorithm.
	// Bochs complains about the second one.  Too bad for Bochs.
	for (i = 0; i < 2; i++) {
		lapicw(ICRHI, apicid << 24);
		lapicw(ICRLO, STARTUP | (addr >> 12));
f01060ed:	c1 eb 0c             	shr    $0xc,%ebx
f01060f0:	80 cf 06             	or     $0x6,%bh
		lapicw(ICRHI, apicid << 24);
f01060f3:	89 f2                	mov    %esi,%edx
f01060f5:	b8 c4 00 00 00       	mov    $0xc4,%eax
f01060fa:	e8 f7 fd ff ff       	call   f0105ef6 <lapicw>
		lapicw(ICRLO, STARTUP | (addr >> 12));
f01060ff:	89 da                	mov    %ebx,%edx
f0106101:	b8 c0 00 00 00       	mov    $0xc0,%eax
f0106106:	e8 eb fd ff ff       	call   f0105ef6 <lapicw>
		lapicw(ICRHI, apicid << 24);
f010610b:	89 f2                	mov    %esi,%edx
f010610d:	b8 c4 00 00 00       	mov    $0xc4,%eax
f0106112:	e8 df fd ff ff       	call   f0105ef6 <lapicw>
		lapicw(ICRLO, STARTUP | (addr >> 12));
f0106117:	89 da                	mov    %ebx,%edx
f0106119:	b8 c0 00 00 00       	mov    $0xc0,%eax
f010611e:	e8 d3 fd ff ff       	call   f0105ef6 <lapicw>
		microdelay(200);
	}
}
f0106123:	8d 65 f8             	lea    -0x8(%ebp),%esp
f0106126:	5b                   	pop    %ebx
f0106127:	5e                   	pop    %esi
f0106128:	5d                   	pop    %ebp
f0106129:	c3                   	ret    
		_panic(file, line, "KADDR called with invalid pa %08lx", pa);
f010612a:	68 67 04 00 00       	push   $0x467
f010612f:	68 a4 65 10 f0       	push   $0xf01065a4
f0106134:	68 98 00 00 00       	push   $0x98
f0106139:	68 54 81 10 f0       	push   $0xf0108154
f010613e:	e8 fd 9e ff ff       	call   f0100040 <_panic>

f0106143 <lapic_ipi>:

void
lapic_ipi(int vector)
{
f0106143:	f3 0f 1e fb          	endbr32 
f0106147:	55                   	push   %ebp
f0106148:	89 e5                	mov    %esp,%ebp
f010614a:	83 ec 08             	sub    $0x8,%esp
	lapicw(ICRLO, OTHERS | FIXED | vector);
f010614d:	8b 55 08             	mov    0x8(%ebp),%edx
f0106150:	81 ca 00 00 0c 00    	or     $0xc0000,%edx
f0106156:	b8 c0 00 00 00       	mov    $0xc0,%eax
f010615b:	e8 96 fd ff ff       	call   f0105ef6 <lapicw>
	while (lapic[ICRLO] & DELIVS)
f0106160:	8b 15 04 90 25 f0    	mov    0xf0259004,%edx
f0106166:	8b 82 00 03 00 00    	mov    0x300(%edx),%eax
f010616c:	f6 c4 10             	test   $0x10,%ah
f010616f:	75 f5                	jne    f0106166 <lapic_ipi+0x23>
		;
}
f0106171:	c9                   	leave  
f0106172:	c3                   	ret    

f0106173 <__spin_initlock>:
}
#endif

void
__spin_initlock(struct spinlock *lk, char *name)
{
f0106173:	f3 0f 1e fb          	endbr32 
f0106177:	55                   	push   %ebp
f0106178:	89 e5                	mov    %esp,%ebp
f010617a:	8b 45 08             	mov    0x8(%ebp),%eax
	lk->locked = 0;
f010617d:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
#ifdef DEBUG_SPINLOCK
	lk->name = name;
f0106183:	8b 55 0c             	mov    0xc(%ebp),%edx
f0106186:	89 50 04             	mov    %edx,0x4(%eax)
	lk->cpu = 0;
f0106189:	c7 40 08 00 00 00 00 	movl   $0x0,0x8(%eax)
#endif
}
f0106190:	5d                   	pop    %ebp
f0106191:	c3                   	ret    

f0106192 <spin_lock>:
// Loops (spins) until the lock is acquired.
// Holding a lock for a long time may cause
// other CPUs to waste time spinning to acquire it.
void
spin_lock(struct spinlock *lk)
{
f0106192:	f3 0f 1e fb          	endbr32 
f0106196:	55                   	push   %ebp
f0106197:	89 e5                	mov    %esp,%ebp
f0106199:	56                   	push   %esi
f010619a:	53                   	push   %ebx
f010619b:	8b 5d 08             	mov    0x8(%ebp),%ebx
	return lock->locked && lock->cpu == thiscpu;
f010619e:	83 3b 00             	cmpl   $0x0,(%ebx)
f01061a1:	75 07                	jne    f01061aa <spin_lock+0x18>
	asm volatile("lock; xchgl %0, %1"
f01061a3:	ba 01 00 00 00       	mov    $0x1,%edx
f01061a8:	eb 34                	jmp    f01061de <spin_lock+0x4c>
f01061aa:	8b 73 08             	mov    0x8(%ebx),%esi
f01061ad:	e8 58 fd ff ff       	call   f0105f0a <cpunum>
f01061b2:	6b c0 74             	imul   $0x74,%eax,%eax
f01061b5:	05 20 80 21 f0       	add    $0xf0218020,%eax
#ifdef DEBUG_SPINLOCK
	if (holding(lk))
f01061ba:	39 c6                	cmp    %eax,%esi
f01061bc:	75 e5                	jne    f01061a3 <spin_lock+0x11>
		panic("CPU %d cannot acquire %s: already holding", cpunum(), lk->name);
f01061be:	8b 5b 04             	mov    0x4(%ebx),%ebx
f01061c1:	e8 44 fd ff ff       	call   f0105f0a <cpunum>
f01061c6:	83 ec 0c             	sub    $0xc,%esp
f01061c9:	53                   	push   %ebx
f01061ca:	50                   	push   %eax
f01061cb:	68 64 81 10 f0       	push   $0xf0108164
f01061d0:	6a 41                	push   $0x41
f01061d2:	68 c6 81 10 f0       	push   $0xf01081c6
f01061d7:	e8 64 9e ff ff       	call   f0100040 <_panic>

	// The xchg is atomic.
	// It also serializes, so that reads after acquire are not
	// reordered before it. 
	while (xchg(&lk->locked, 1) != 0)
		asm volatile ("pause");
f01061dc:	f3 90                	pause  
f01061de:	89 d0                	mov    %edx,%eax
f01061e0:	f0 87 03             	lock xchg %eax,(%ebx)
	while (xchg(&lk->locked, 1) != 0)
f01061e3:	85 c0                	test   %eax,%eax
f01061e5:	75 f5                	jne    f01061dc <spin_lock+0x4a>

	// Record info about lock acquisition for debugging.
#ifdef DEBUG_SPINLOCK
	lk->cpu = thiscpu;
f01061e7:	e8 1e fd ff ff       	call   f0105f0a <cpunum>
f01061ec:	6b c0 74             	imul   $0x74,%eax,%eax
f01061ef:	05 20 80 21 f0       	add    $0xf0218020,%eax
f01061f4:	89 43 08             	mov    %eax,0x8(%ebx)
	asm volatile("movl %%ebp,%0" : "=r" (ebp));
f01061f7:	89 ea                	mov    %ebp,%edx
	for (i = 0; i < 10; i++){
f01061f9:	b8 00 00 00 00       	mov    $0x0,%eax
		if (ebp == 0 || ebp < (uint32_t *)ULIM)
f01061fe:	83 f8 09             	cmp    $0x9,%eax
f0106201:	7f 21                	jg     f0106224 <spin_lock+0x92>
f0106203:	81 fa ff ff 7f ef    	cmp    $0xef7fffff,%edx
f0106209:	76 19                	jbe    f0106224 <spin_lock+0x92>
		pcs[i] = ebp[1];          // saved %eip
f010620b:	8b 4a 04             	mov    0x4(%edx),%ecx
f010620e:	89 4c 83 0c          	mov    %ecx,0xc(%ebx,%eax,4)
		ebp = (uint32_t *)ebp[0]; // saved %ebp
f0106212:	8b 12                	mov    (%edx),%edx
	for (i = 0; i < 10; i++){
f0106214:	83 c0 01             	add    $0x1,%eax
f0106217:	eb e5                	jmp    f01061fe <spin_lock+0x6c>
		pcs[i] = 0;
f0106219:	c7 44 83 0c 00 00 00 	movl   $0x0,0xc(%ebx,%eax,4)
f0106220:	00 
	for (; i < 10; i++)
f0106221:	83 c0 01             	add    $0x1,%eax
f0106224:	83 f8 09             	cmp    $0x9,%eax
f0106227:	7e f0                	jle    f0106219 <spin_lock+0x87>
	get_caller_pcs(lk->pcs);
#endif
}
f0106229:	8d 65 f8             	lea    -0x8(%ebp),%esp
f010622c:	5b                   	pop    %ebx
f010622d:	5e                   	pop    %esi
f010622e:	5d                   	pop    %ebp
f010622f:	c3                   	ret    

f0106230 <spin_unlock>:

// Release the lock.
void
spin_unlock(struct spinlock *lk)
{
f0106230:	f3 0f 1e fb          	endbr32 
f0106234:	55                   	push   %ebp
f0106235:	89 e5                	mov    %esp,%ebp
f0106237:	57                   	push   %edi
f0106238:	56                   	push   %esi
f0106239:	53                   	push   %ebx
f010623a:	83 ec 4c             	sub    $0x4c,%esp
f010623d:	8b 75 08             	mov    0x8(%ebp),%esi
	return lock->locked && lock->cpu == thiscpu;
f0106240:	83 3e 00             	cmpl   $0x0,(%esi)
f0106243:	75 35                	jne    f010627a <spin_unlock+0x4a>
#ifdef DEBUG_SPINLOCK
	if (!holding(lk)) {
		int i;
		uint32_t pcs[10];
		// Nab the acquiring EIP chain before it gets released
		memmove(pcs, lk->pcs, sizeof pcs);
f0106245:	83 ec 04             	sub    $0x4,%esp
f0106248:	6a 28                	push   $0x28
f010624a:	8d 46 0c             	lea    0xc(%esi),%eax
f010624d:	50                   	push   %eax
f010624e:	8d 5d c0             	lea    -0x40(%ebp),%ebx
f0106251:	53                   	push   %ebx
f0106252:	e8 df f6 ff ff       	call   f0105936 <memmove>
		cprintf("CPU %d cannot release %s: held by CPU %d\nAcquired at:", 
			cpunum(), lk->name, lk->cpu->cpu_id);
f0106257:	8b 46 08             	mov    0x8(%esi),%eax
		cprintf("CPU %d cannot release %s: held by CPU %d\nAcquired at:", 
f010625a:	0f b6 38             	movzbl (%eax),%edi
f010625d:	8b 76 04             	mov    0x4(%esi),%esi
f0106260:	e8 a5 fc ff ff       	call   f0105f0a <cpunum>
f0106265:	57                   	push   %edi
f0106266:	56                   	push   %esi
f0106267:	50                   	push   %eax
f0106268:	68 90 81 10 f0       	push   $0xf0108190
f010626d:	e8 6b d5 ff ff       	call   f01037dd <cprintf>
f0106272:	83 c4 20             	add    $0x20,%esp
		for (i = 0; i < 10 && pcs[i]; i++) {
			struct Eipdebuginfo info;
			if (debuginfo_eip(pcs[i], &info) >= 0)
f0106275:	8d 7d a8             	lea    -0x58(%ebp),%edi
f0106278:	eb 4e                	jmp    f01062c8 <spin_unlock+0x98>
	return lock->locked && lock->cpu == thiscpu;
f010627a:	8b 5e 08             	mov    0x8(%esi),%ebx
f010627d:	e8 88 fc ff ff       	call   f0105f0a <cpunum>
f0106282:	6b c0 74             	imul   $0x74,%eax,%eax
f0106285:	05 20 80 21 f0       	add    $0xf0218020,%eax
	if (!holding(lk)) {
f010628a:	39 c3                	cmp    %eax,%ebx
f010628c:	75 b7                	jne    f0106245 <spin_unlock+0x15>
				cprintf("  %08x\n", pcs[i]);
		}
		panic("spin_unlock");
	}

	lk->pcs[0] = 0;
f010628e:	c7 46 0c 00 00 00 00 	movl   $0x0,0xc(%esi)
	lk->cpu = 0;
f0106295:	c7 46 08 00 00 00 00 	movl   $0x0,0x8(%esi)
	asm volatile("lock; xchgl %0, %1"
f010629c:	b8 00 00 00 00       	mov    $0x0,%eax
f01062a1:	f0 87 06             	lock xchg %eax,(%esi)
	// respect to any other instruction which references the same memory.
	// x86 CPUs will not reorder loads/stores across locked instructions
	// (vol 3, 8.2.2). Because xchg() is implemented using asm volatile,
	// gcc will not reorder C statements across the xchg.
	xchg(&lk->locked, 0);
}
f01062a4:	8d 65 f4             	lea    -0xc(%ebp),%esp
f01062a7:	5b                   	pop    %ebx
f01062a8:	5e                   	pop    %esi
f01062a9:	5f                   	pop    %edi
f01062aa:	5d                   	pop    %ebp
f01062ab:	c3                   	ret    
				cprintf("  %08x\n", pcs[i]);
f01062ac:	83 ec 08             	sub    $0x8,%esp
f01062af:	ff 36                	pushl  (%esi)
f01062b1:	68 ed 81 10 f0       	push   $0xf01081ed
f01062b6:	e8 22 d5 ff ff       	call   f01037dd <cprintf>
f01062bb:	83 c4 10             	add    $0x10,%esp
f01062be:	83 c3 04             	add    $0x4,%ebx
		for (i = 0; i < 10 && pcs[i]; i++) {
f01062c1:	8d 45 e8             	lea    -0x18(%ebp),%eax
f01062c4:	39 c3                	cmp    %eax,%ebx
f01062c6:	74 40                	je     f0106308 <spin_unlock+0xd8>
f01062c8:	89 de                	mov    %ebx,%esi
f01062ca:	8b 03                	mov    (%ebx),%eax
f01062cc:	85 c0                	test   %eax,%eax
f01062ce:	74 38                	je     f0106308 <spin_unlock+0xd8>
			if (debuginfo_eip(pcs[i], &info) >= 0)
f01062d0:	83 ec 08             	sub    $0x8,%esp
f01062d3:	57                   	push   %edi
f01062d4:	50                   	push   %eax
f01062d5:	e8 13 ec ff ff       	call   f0104eed <debuginfo_eip>
f01062da:	83 c4 10             	add    $0x10,%esp
f01062dd:	85 c0                	test   %eax,%eax
f01062df:	78 cb                	js     f01062ac <spin_unlock+0x7c>
					pcs[i] - info.eip_fn_addr);
f01062e1:	8b 06                	mov    (%esi),%eax
				cprintf("  %08x %s:%d: %.*s+%x\n", pcs[i],
f01062e3:	83 ec 04             	sub    $0x4,%esp
f01062e6:	89 c2                	mov    %eax,%edx
f01062e8:	2b 55 b8             	sub    -0x48(%ebp),%edx
f01062eb:	52                   	push   %edx
f01062ec:	ff 75 b0             	pushl  -0x50(%ebp)
f01062ef:	ff 75 b4             	pushl  -0x4c(%ebp)
f01062f2:	ff 75 ac             	pushl  -0x54(%ebp)
f01062f5:	ff 75 a8             	pushl  -0x58(%ebp)
f01062f8:	50                   	push   %eax
f01062f9:	68 d6 81 10 f0       	push   $0xf01081d6
f01062fe:	e8 da d4 ff ff       	call   f01037dd <cprintf>
f0106303:	83 c4 20             	add    $0x20,%esp
f0106306:	eb b6                	jmp    f01062be <spin_unlock+0x8e>
		panic("spin_unlock");
f0106308:	83 ec 04             	sub    $0x4,%esp
f010630b:	68 f5 81 10 f0       	push   $0xf01081f5
f0106310:	6a 67                	push   $0x67
f0106312:	68 c6 81 10 f0       	push   $0xf01081c6
f0106317:	e8 24 9d ff ff       	call   f0100040 <_panic>
f010631c:	66 90                	xchg   %ax,%ax
f010631e:	66 90                	xchg   %ax,%ax

f0106320 <__udivdi3>:
f0106320:	f3 0f 1e fb          	endbr32 
f0106324:	55                   	push   %ebp
f0106325:	57                   	push   %edi
f0106326:	56                   	push   %esi
f0106327:	53                   	push   %ebx
f0106328:	83 ec 1c             	sub    $0x1c,%esp
f010632b:	8b 54 24 3c          	mov    0x3c(%esp),%edx
f010632f:	8b 6c 24 30          	mov    0x30(%esp),%ebp
f0106333:	8b 74 24 34          	mov    0x34(%esp),%esi
f0106337:	8b 5c 24 38          	mov    0x38(%esp),%ebx
f010633b:	85 d2                	test   %edx,%edx
f010633d:	75 19                	jne    f0106358 <__udivdi3+0x38>
f010633f:	39 f3                	cmp    %esi,%ebx
f0106341:	76 4d                	jbe    f0106390 <__udivdi3+0x70>
f0106343:	31 ff                	xor    %edi,%edi
f0106345:	89 e8                	mov    %ebp,%eax
f0106347:	89 f2                	mov    %esi,%edx
f0106349:	f7 f3                	div    %ebx
f010634b:	89 fa                	mov    %edi,%edx
f010634d:	83 c4 1c             	add    $0x1c,%esp
f0106350:	5b                   	pop    %ebx
f0106351:	5e                   	pop    %esi
f0106352:	5f                   	pop    %edi
f0106353:	5d                   	pop    %ebp
f0106354:	c3                   	ret    
f0106355:	8d 76 00             	lea    0x0(%esi),%esi
f0106358:	39 f2                	cmp    %esi,%edx
f010635a:	76 14                	jbe    f0106370 <__udivdi3+0x50>
f010635c:	31 ff                	xor    %edi,%edi
f010635e:	31 c0                	xor    %eax,%eax
f0106360:	89 fa                	mov    %edi,%edx
f0106362:	83 c4 1c             	add    $0x1c,%esp
f0106365:	5b                   	pop    %ebx
f0106366:	5e                   	pop    %esi
f0106367:	5f                   	pop    %edi
f0106368:	5d                   	pop    %ebp
f0106369:	c3                   	ret    
f010636a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
f0106370:	0f bd fa             	bsr    %edx,%edi
f0106373:	83 f7 1f             	xor    $0x1f,%edi
f0106376:	75 48                	jne    f01063c0 <__udivdi3+0xa0>
f0106378:	39 f2                	cmp    %esi,%edx
f010637a:	72 06                	jb     f0106382 <__udivdi3+0x62>
f010637c:	31 c0                	xor    %eax,%eax
f010637e:	39 eb                	cmp    %ebp,%ebx
f0106380:	77 de                	ja     f0106360 <__udivdi3+0x40>
f0106382:	b8 01 00 00 00       	mov    $0x1,%eax
f0106387:	eb d7                	jmp    f0106360 <__udivdi3+0x40>
f0106389:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
f0106390:	89 d9                	mov    %ebx,%ecx
f0106392:	85 db                	test   %ebx,%ebx
f0106394:	75 0b                	jne    f01063a1 <__udivdi3+0x81>
f0106396:	b8 01 00 00 00       	mov    $0x1,%eax
f010639b:	31 d2                	xor    %edx,%edx
f010639d:	f7 f3                	div    %ebx
f010639f:	89 c1                	mov    %eax,%ecx
f01063a1:	31 d2                	xor    %edx,%edx
f01063a3:	89 f0                	mov    %esi,%eax
f01063a5:	f7 f1                	div    %ecx
f01063a7:	89 c6                	mov    %eax,%esi
f01063a9:	89 e8                	mov    %ebp,%eax
f01063ab:	89 f7                	mov    %esi,%edi
f01063ad:	f7 f1                	div    %ecx
f01063af:	89 fa                	mov    %edi,%edx
f01063b1:	83 c4 1c             	add    $0x1c,%esp
f01063b4:	5b                   	pop    %ebx
f01063b5:	5e                   	pop    %esi
f01063b6:	5f                   	pop    %edi
f01063b7:	5d                   	pop    %ebp
f01063b8:	c3                   	ret    
f01063b9:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
f01063c0:	89 f9                	mov    %edi,%ecx
f01063c2:	b8 20 00 00 00       	mov    $0x20,%eax
f01063c7:	29 f8                	sub    %edi,%eax
f01063c9:	d3 e2                	shl    %cl,%edx
f01063cb:	89 54 24 08          	mov    %edx,0x8(%esp)
f01063cf:	89 c1                	mov    %eax,%ecx
f01063d1:	89 da                	mov    %ebx,%edx
f01063d3:	d3 ea                	shr    %cl,%edx
f01063d5:	8b 4c 24 08          	mov    0x8(%esp),%ecx
f01063d9:	09 d1                	or     %edx,%ecx
f01063db:	89 f2                	mov    %esi,%edx
f01063dd:	89 4c 24 08          	mov    %ecx,0x8(%esp)
f01063e1:	89 f9                	mov    %edi,%ecx
f01063e3:	d3 e3                	shl    %cl,%ebx
f01063e5:	89 c1                	mov    %eax,%ecx
f01063e7:	d3 ea                	shr    %cl,%edx
f01063e9:	89 f9                	mov    %edi,%ecx
f01063eb:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
f01063ef:	89 eb                	mov    %ebp,%ebx
f01063f1:	d3 e6                	shl    %cl,%esi
f01063f3:	89 c1                	mov    %eax,%ecx
f01063f5:	d3 eb                	shr    %cl,%ebx
f01063f7:	09 de                	or     %ebx,%esi
f01063f9:	89 f0                	mov    %esi,%eax
f01063fb:	f7 74 24 08          	divl   0x8(%esp)
f01063ff:	89 d6                	mov    %edx,%esi
f0106401:	89 c3                	mov    %eax,%ebx
f0106403:	f7 64 24 0c          	mull   0xc(%esp)
f0106407:	39 d6                	cmp    %edx,%esi
f0106409:	72 15                	jb     f0106420 <__udivdi3+0x100>
f010640b:	89 f9                	mov    %edi,%ecx
f010640d:	d3 e5                	shl    %cl,%ebp
f010640f:	39 c5                	cmp    %eax,%ebp
f0106411:	73 04                	jae    f0106417 <__udivdi3+0xf7>
f0106413:	39 d6                	cmp    %edx,%esi
f0106415:	74 09                	je     f0106420 <__udivdi3+0x100>
f0106417:	89 d8                	mov    %ebx,%eax
f0106419:	31 ff                	xor    %edi,%edi
f010641b:	e9 40 ff ff ff       	jmp    f0106360 <__udivdi3+0x40>
f0106420:	8d 43 ff             	lea    -0x1(%ebx),%eax
f0106423:	31 ff                	xor    %edi,%edi
f0106425:	e9 36 ff ff ff       	jmp    f0106360 <__udivdi3+0x40>
f010642a:	66 90                	xchg   %ax,%ax
f010642c:	66 90                	xchg   %ax,%ax
f010642e:	66 90                	xchg   %ax,%ax

f0106430 <__umoddi3>:
f0106430:	f3 0f 1e fb          	endbr32 
f0106434:	55                   	push   %ebp
f0106435:	57                   	push   %edi
f0106436:	56                   	push   %esi
f0106437:	53                   	push   %ebx
f0106438:	83 ec 1c             	sub    $0x1c,%esp
f010643b:	8b 44 24 3c          	mov    0x3c(%esp),%eax
f010643f:	8b 74 24 30          	mov    0x30(%esp),%esi
f0106443:	8b 5c 24 34          	mov    0x34(%esp),%ebx
f0106447:	8b 7c 24 38          	mov    0x38(%esp),%edi
f010644b:	85 c0                	test   %eax,%eax
f010644d:	75 19                	jne    f0106468 <__umoddi3+0x38>
f010644f:	39 df                	cmp    %ebx,%edi
f0106451:	76 5d                	jbe    f01064b0 <__umoddi3+0x80>
f0106453:	89 f0                	mov    %esi,%eax
f0106455:	89 da                	mov    %ebx,%edx
f0106457:	f7 f7                	div    %edi
f0106459:	89 d0                	mov    %edx,%eax
f010645b:	31 d2                	xor    %edx,%edx
f010645d:	83 c4 1c             	add    $0x1c,%esp
f0106460:	5b                   	pop    %ebx
f0106461:	5e                   	pop    %esi
f0106462:	5f                   	pop    %edi
f0106463:	5d                   	pop    %ebp
f0106464:	c3                   	ret    
f0106465:	8d 76 00             	lea    0x0(%esi),%esi
f0106468:	89 f2                	mov    %esi,%edx
f010646a:	39 d8                	cmp    %ebx,%eax
f010646c:	76 12                	jbe    f0106480 <__umoddi3+0x50>
f010646e:	89 f0                	mov    %esi,%eax
f0106470:	89 da                	mov    %ebx,%edx
f0106472:	83 c4 1c             	add    $0x1c,%esp
f0106475:	5b                   	pop    %ebx
f0106476:	5e                   	pop    %esi
f0106477:	5f                   	pop    %edi
f0106478:	5d                   	pop    %ebp
f0106479:	c3                   	ret    
f010647a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
f0106480:	0f bd e8             	bsr    %eax,%ebp
f0106483:	83 f5 1f             	xor    $0x1f,%ebp
f0106486:	75 50                	jne    f01064d8 <__umoddi3+0xa8>
f0106488:	39 d8                	cmp    %ebx,%eax
f010648a:	0f 82 e0 00 00 00    	jb     f0106570 <__umoddi3+0x140>
f0106490:	89 d9                	mov    %ebx,%ecx
f0106492:	39 f7                	cmp    %esi,%edi
f0106494:	0f 86 d6 00 00 00    	jbe    f0106570 <__umoddi3+0x140>
f010649a:	89 d0                	mov    %edx,%eax
f010649c:	89 ca                	mov    %ecx,%edx
f010649e:	83 c4 1c             	add    $0x1c,%esp
f01064a1:	5b                   	pop    %ebx
f01064a2:	5e                   	pop    %esi
f01064a3:	5f                   	pop    %edi
f01064a4:	5d                   	pop    %ebp
f01064a5:	c3                   	ret    
f01064a6:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
f01064ad:	8d 76 00             	lea    0x0(%esi),%esi
f01064b0:	89 fd                	mov    %edi,%ebp
f01064b2:	85 ff                	test   %edi,%edi
f01064b4:	75 0b                	jne    f01064c1 <__umoddi3+0x91>
f01064b6:	b8 01 00 00 00       	mov    $0x1,%eax
f01064bb:	31 d2                	xor    %edx,%edx
f01064bd:	f7 f7                	div    %edi
f01064bf:	89 c5                	mov    %eax,%ebp
f01064c1:	89 d8                	mov    %ebx,%eax
f01064c3:	31 d2                	xor    %edx,%edx
f01064c5:	f7 f5                	div    %ebp
f01064c7:	89 f0                	mov    %esi,%eax
f01064c9:	f7 f5                	div    %ebp
f01064cb:	89 d0                	mov    %edx,%eax
f01064cd:	31 d2                	xor    %edx,%edx
f01064cf:	eb 8c                	jmp    f010645d <__umoddi3+0x2d>
f01064d1:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
f01064d8:	89 e9                	mov    %ebp,%ecx
f01064da:	ba 20 00 00 00       	mov    $0x20,%edx
f01064df:	29 ea                	sub    %ebp,%edx
f01064e1:	d3 e0                	shl    %cl,%eax
f01064e3:	89 44 24 08          	mov    %eax,0x8(%esp)
f01064e7:	89 d1                	mov    %edx,%ecx
f01064e9:	89 f8                	mov    %edi,%eax
f01064eb:	d3 e8                	shr    %cl,%eax
f01064ed:	8b 4c 24 08          	mov    0x8(%esp),%ecx
f01064f1:	89 54 24 04          	mov    %edx,0x4(%esp)
f01064f5:	8b 54 24 04          	mov    0x4(%esp),%edx
f01064f9:	09 c1                	or     %eax,%ecx
f01064fb:	89 d8                	mov    %ebx,%eax
f01064fd:	89 4c 24 08          	mov    %ecx,0x8(%esp)
f0106501:	89 e9                	mov    %ebp,%ecx
f0106503:	d3 e7                	shl    %cl,%edi
f0106505:	89 d1                	mov    %edx,%ecx
f0106507:	d3 e8                	shr    %cl,%eax
f0106509:	89 e9                	mov    %ebp,%ecx
f010650b:	89 7c 24 0c          	mov    %edi,0xc(%esp)
f010650f:	d3 e3                	shl    %cl,%ebx
f0106511:	89 c7                	mov    %eax,%edi
f0106513:	89 d1                	mov    %edx,%ecx
f0106515:	89 f0                	mov    %esi,%eax
f0106517:	d3 e8                	shr    %cl,%eax
f0106519:	89 e9                	mov    %ebp,%ecx
f010651b:	89 fa                	mov    %edi,%edx
f010651d:	d3 e6                	shl    %cl,%esi
f010651f:	09 d8                	or     %ebx,%eax
f0106521:	f7 74 24 08          	divl   0x8(%esp)
f0106525:	89 d1                	mov    %edx,%ecx
f0106527:	89 f3                	mov    %esi,%ebx
f0106529:	f7 64 24 0c          	mull   0xc(%esp)
f010652d:	89 c6                	mov    %eax,%esi
f010652f:	89 d7                	mov    %edx,%edi
f0106531:	39 d1                	cmp    %edx,%ecx
f0106533:	72 06                	jb     f010653b <__umoddi3+0x10b>
f0106535:	75 10                	jne    f0106547 <__umoddi3+0x117>
f0106537:	39 c3                	cmp    %eax,%ebx
f0106539:	73 0c                	jae    f0106547 <__umoddi3+0x117>
f010653b:	2b 44 24 0c          	sub    0xc(%esp),%eax
f010653f:	1b 54 24 08          	sbb    0x8(%esp),%edx
f0106543:	89 d7                	mov    %edx,%edi
f0106545:	89 c6                	mov    %eax,%esi
f0106547:	89 ca                	mov    %ecx,%edx
f0106549:	0f b6 4c 24 04       	movzbl 0x4(%esp),%ecx
f010654e:	29 f3                	sub    %esi,%ebx
f0106550:	19 fa                	sbb    %edi,%edx
f0106552:	89 d0                	mov    %edx,%eax
f0106554:	d3 e0                	shl    %cl,%eax
f0106556:	89 e9                	mov    %ebp,%ecx
f0106558:	d3 eb                	shr    %cl,%ebx
f010655a:	d3 ea                	shr    %cl,%edx
f010655c:	09 d8                	or     %ebx,%eax
f010655e:	83 c4 1c             	add    $0x1c,%esp
f0106561:	5b                   	pop    %ebx
f0106562:	5e                   	pop    %esi
f0106563:	5f                   	pop    %edi
f0106564:	5d                   	pop    %ebp
f0106565:	c3                   	ret    
f0106566:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
f010656d:	8d 76 00             	lea    0x0(%esi),%esi
f0106570:	29 fe                	sub    %edi,%esi
f0106572:	19 c3                	sbb    %eax,%ebx
f0106574:	89 f2                	mov    %esi,%edx
f0106576:	89 d9                	mov    %ebx,%ecx
f0106578:	e9 1d ff ff ff       	jmp    f010649a <__umoddi3+0x6a>
